導入頭文件
在 linux 中開發多線程程序,在使用到 pthread 系列函數的文件中,需要導入頭文件:
#include <pthread.h>
鏈接 libpthread.a
在編譯的時候,需要鏈接 libpthread.a 庫
eclipse 中添加 libpthread.a 庫:
Project -> Properties -> C/C++ Build -> Settings -> GCC C Linker -> Libraries
1. 在 Libraries(-l) 中添加 pthread
2. 在 Libraries search path(-L) 中添加 crypto