当前位置: 技术问答>linux和unix
线程编程问题
来源: 互联网 发布时间:2015-03-15
本文导语: 用make threadc.c提示: /tmp/ccF2nwkm.o: In function `main': /tmp/ccF2nwkm.o(.text+0x21): undefined reference to `pthread_create' /tmp/ccF2nwkm.o(.text+0x5c): undefined reference to `pthread_create' /tmp/ccF2nwkm.o(.text+0x8f): undefined reference to `pthread_join' /t...
用make threadc.c提示:
/tmp/ccF2nwkm.o: In function `main':
/tmp/ccF2nwkm.o(.text+0x21): undefined reference to `pthread_create'
/tmp/ccF2nwkm.o(.text+0x5c): undefined reference to `pthread_create'
/tmp/ccF2nwkm.o(.text+0x8f): undefined reference to `pthread_join'
/tmp/ccF2nwkm.o(.text+0x9f): undefined reference to `pthread_join'
collect2: ld returned 1 exit status
make: *** [thrdcreate] Error 1
源码就不用我再给了吧
/tmp/ccF2nwkm.o: In function `main':
/tmp/ccF2nwkm.o(.text+0x21): undefined reference to `pthread_create'
/tmp/ccF2nwkm.o(.text+0x5c): undefined reference to `pthread_create'
/tmp/ccF2nwkm.o(.text+0x8f): undefined reference to `pthread_join'
/tmp/ccF2nwkm.o(.text+0x9f): undefined reference to `pthread_join'
collect2: ld returned 1 exit status
make: *** [thrdcreate] Error 1
源码就不用我再给了吧
|
没有看仔细,原来在命令行下
编译时加选项:-lpthread
编译时加选项:-lpthread
|
把pthread_create函数的裤文件包含进去。。。
楼上老兄。。。乐死我了。呵呵。
楼上老兄。。。乐死我了。呵呵。
|
没有加pthread库