undefined reference to 'pthread_create'问题解决(转)
生活随笔
收集整理的這篇文章主要介紹了
undefined reference to 'pthread_create'问题解决(转)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
undefined reference to 'pthread_create'
undefined reference to 'pthread_join'
問題原因:
????pthread 庫不是 Linux 系統默認的庫,連接時需要使用靜態庫 libpthread.a,所以在使用pthread_create()創建線程,以及調用 pthread_atfork()函數建立fork處理程序時,需要鏈接該庫。
問題解決:
??? 在編譯中要加 -lpthread參數
undefined reference to 'pthread_join'
問題原因:
????pthread 庫不是 Linux 系統默認的庫,連接時需要使用靜態庫 libpthread.a,所以在使用pthread_create()創建線程,以及調用 pthread_atfork()函數建立fork處理程序時,需要鏈接該庫。
問題解決:
??? 在編譯中要加 -lpthread參數
轉載于:https://www.cnblogs.com/Myhsg/archive/2009/09/10/1563911.html
總結
以上是生活随笔為你收集整理的undefined reference to 'pthread_create'问题解决(转)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 劝君莫打的下一句是什么呢?
- 下一篇: 读书笔记之知识杂点