gcc编译出现undefined reference to 'pthread_create'的解决方法
2015-01-29 22:59
639 查看
下面, 我们先看一个linux多线程程序:
#include <pthread.h> #include <stdio.h> void* threadFunc(void* p) { while (1) { printf("a"); } return NULL; } int main () { pthread_t id; pthread_create (&id, NULL, threadFunc, NULL); while (1) { printf("b"); } return 0; }在linux上执行gcc thread.c, 结果出现编译错误undefined reference to 'pthread_create'。由于pthread库不是标准linux库, 所以出错。 改为gcc thread.c -lpthread 即可。
相关文章推荐
- eclipse编译openwrt应用程序报Type undefined reference to `pthread_create'错误解决方法
- gcc 编译出现undefined reference to‘pthread_create’的错误
- Linux 编译报错 -- undefined reference to 问题解决方法 (具体'pthread_create'和opencv看文章最后两条)
- linux下开发,解决cocos2d-x中编译出现的一个小问题, undefined reference to symbol 'pthread_create@@GLIBC_2.2.5'
- linux下开发,解决cocos2d-x中编译出现的一个小问题, undefined reference to symbol 'pthread_create@@GLIBC_2.2.5'
- 关于arm-linux-gcc交叉编译工具链,实现自己的crt0或者编译UBOOT出现undefined reference to `__aeabi_unwind_cpp_pr0'的解决方法
- GCC编译uboot出现(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'错误的解决的方法
- 解决undefined reference to `pthread_create'的方法
- 关于android底层库编译出现“undefined reference to `__android_log_print'”的解决方法
- ubuntu 下没有pthread库以及报undefined reference to 'pthread_create'的解决方法
- undefined reference to `pthread_create'错误通过makefie的解决方法
- undefined reference to 'pthread_create'的解决方法
- gcc编译线程程序需带-lpthread选项(否则出错:undefined reference to `pthread_create')
- Qt4.8.5编译qvfb出现undefined reference to `png_create_write_struct'问题解决办法
- 编译3.10内核 出现错误 “undefined reference to...." 解决方法
- 在linux上编译cppunit1.12.1出现'undefined reference to `dlclose''的解决方法
- undefined reference to `pthread_create'解决方法
- ffmpeg libx264编译出现error: undefined reference to 'x264_picture_init'等问题的解决方法
- QT 编译出现 undefined reference to `vtable for xx' 的解决方法
- 用gcc编译.cpp文件可能出现"undefined reference to `__gxx_personality_v0'"问题的解决