由于pthread库不是Linux系统默认的库,连接时需要使用库libpthread.a,所以在使用pthread_create创建线程时,在编译中要加-lpthread参数:
g++ pthread.c -lpthread -o pthread
c++ 多线程编译时出现error:对‘pthread_create’未定义的引用,解决办法
最新推荐文章于 2022-09-18 15:53:24 发布
由于pthread库不是Linux系统默认的库,连接时需要使用库libpthread.a,所以在使用pthread_create创建线程时,在编译中要加-lpthread参数:
g++ pthread.c -lpthread -o pthread