解决implicit declaration of function 'pthread_creat'


情况:

用开发板写个小项目,创建线程的时候出现warning: implicit declaration of function ‘pthread_creat’,虽然是warning但make不出来。

解决:

1.函数名pthread_create

2.添加头文件#include

3.系统为ubuntu 20.04 wsl。pthread库不是Linux系统默认的库,编译的时候需要加上库。在Makefile文件,编译库中加上-lpthread