linux中pthread 线程加入包含

查找资料知道,pthread 库不是 Linux 系统默认的库,连接时需要使用静态库 libpthread.a,所以在使用pthread_create()创建线程时,在编译中要加 -lpthread参数。

使用g++ main.cpp -o main -lpthread将线程库包含后编译即可运行。

猜你喜欢

转载自blog.csdn.net/qq_35119182/article/details/88586582