linux:gcc编译出“error: ld returned 1 exit status”
运行某书上给的线程创建与结束的例子,在linux下用gcc编译代码,出现如下问题/tmp/cclpFs9V.o: In function `main':test.cpp:(.text+0x52): undefined reference to `pthread_create'test.cpp:(.text+0x89): undefined reference to `pthread_jo...
·
运行某书上给的线程创建与结束的例子,在linux下用gcc编译代码,出现如下问题
/tmp/cclpFs9V.o: In function `main':
test.cpp:(.text+0x52): undefined reference to `pthread_create'
test.cpp:(.text+0x89): undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status
解决方法:
g++ xxx -lpthread
之后再运行程序,成功!
更多推荐
已为社区贡献2条内容
所有评论(0)