C语言 C:体系结构 x86_64 的未定义符号
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5765555/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
C: Undefined symbols for architecture x86_64
提问by system
I call the function phtread_kill(gpsNavigationThread, 0)and ge the following error
我调用函数phtread_kill(gpsNavigationThread, 0)并得到以下错误
Undefined symbols for architecture x86_64:
体系结构 x86_64 的未定义符号:
"_phtread_kill", referenced from:
_startgpswatchdog in ccXXNhjy.o
ld: symbol(s) not found for architecture x86_64
I #include <pthread.h>so am not sure what the issue is.
我#include <pthread.h>不确定是什么问题。
I link as follows
我链接如下
gcc gps_nav.c dijk.c serial.c parser.c nav_corelogic.c -I/usr/include/libxml2 -lxml2 -lm -lpthread -o logic
I also #include signal.h but am not sure if there is a library for linking with it.
我也#include signal.h,但不确定是否有与之链接的库。
回答by karlphillip
It's
它是
pthread_kill(gpsNavigationThread, 0)
not:
不是:
phtread_kill(gpsNavigationThread, 0)
回答by Tom Wadley
Have you linked with the pthreads library: -lpthread
您是否已链接到 pthreads 库:-lpthread
回答by Henno Brandsma
Did you compile with -lpthread ?
你用 -lpthread 编译了吗?
回答by Douglas Leeder
Try the -pthreadoption, which should set the appropriate options for both compilation and linking.
试试这个-pthread选项,它应该为编译和链接设置适当的选项。

