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