undefined reference to 'pthread_create'
生活随笔
收集整理的這篇文章主要介紹了
undefined reference to 'pthread_create'
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
pthread 庫不是 Linux 系統(tǒng)默認(rèn)的庫,連接時(shí)需要使用靜態(tài)庫 libpthread.a,所以在使用pthread_create()創(chuàng)建線程,以及調(diào)用 pthread_atfork()函數(shù)建立fork處理程序時(shí),需要鏈接該庫。
源文件,不要忘了加上頭文件#include<pthread.h>
在編譯中要加 -lpthread參數(shù)
#gcc test.c -o thread -lpthread
#cc test.c? -lpthread
????
總結(jié)
以上是生活随笔為你收集整理的undefined reference to 'pthread_create'的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 超超清4k和全超清1080p哪个更清晰?
- 下一篇: 静态页htm传参数