执行pthread_create的函数出现错误的解决方法

出错的内容是:
root@ubuntu:/mnt/hgfs/NotepadProgram/APPNet# gcc jincheng.c
/tmp/ccFCr5RZ.o: In function main': jincheng.c:(.text+0xa1): **undefined reference topthread_create’**
collect2: error: ld returned 1 exit status

解决方法是:
在编译的时候末尾加上-lpthread,即可编译通过
如下:

root@ubuntu:/mnt/hgfs/NotepadProgram/APPNet# gcc jincheng.c -lpthread
root@ubuntu:/mnt/hgfs/NotepadProgram/APPNet# ./a.out

你可能感兴趣的:(执行pthread_create的函数出现错误的解决方法)