Linux应用程序中,创建多线程时出现如下错误:
undefined reference to 'pthread_create'
问题原因:
没有包含pthread库(该库非Linux系统默认的库,需手动添加)。
解决办法:
makefile 中加上 -lpthread,同时源文件中包含<pthread.h> 头文件。
Linux应用程序中,创建多线程时出现如下错误:
undefined reference to 'pthread_create'
问题原因:
没有包含pthread库(该库非Linux系统默认的库,需手动添加)。
解决办法:
makefile 中加上 -lpthread,同时源文件中包含<pthread.h> 头文件。