eclipse编译线程相关代码,虽然加了pthread.h头文件但是编译报错显示对pthread_create未定义的引用

解决方法:在工程属性中添加pthread库即可

具体操作步骤:

右键自己的工程->propertites->c/c++ Build->Settings->Tool  Settings->Cross Gcc Linker->Libraries

添加ptread库即可

如下图所示:

eclipse编译线程相关代码,虽然加了pthread.h头文件但是编译报错显示对pthread_create未定义的引用

设置完点击apply and close应用改设置并关闭即可