c++ 多线程编译时出现error:对‘pthread_create’未定义的引用,解决办法

由于pthread库不是Linux系统默认的库,连接时需要使用库libpthread.a,所以在使用pthread_create创建线程时,在编译中要加-lpthread参数:
g++ pthread.c 
-lpthread -o pthread

猜你喜欢

转载自blog.csdn.net/yile0000/article/details/80064184
今日推荐