`
从此醉
  • 浏览: 1034572 次
  • 性别: Icon_minigender_1
  • 来自: US
社区版块
存档分类
最新评论

Linux 下Eclipse C 开发:undefined reference to `pthread_create'

 
阅读更多

需要加上编译选项:-lpthread

gcc thread.c -o thread -lpthread


如果所eclipse 开发

方法1:

eclipse
解决方法如下:
方法1:Project->Properties->C/C++ Build->Settings->GCC C++ Linker->Libraries
在Libraries(-l)中添加pthread即可
在Libraries search path(-L)中添加crypto即可


方法2: 点击工程,右键 -> 属性 -> C/C++ Build -> Builder Settings

把自动生成makefile 选项,去选。

打开 debug 文件夹下的 makefile

让后自己手工在makefile 种添加编译选项:

gcc -o "sockThreadClient" $(OBJS) $(USER_OBJS) $(LIBS) -lpthread


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics