C语言线程编译方法备忘

编译C语言多线程程序的时候,如果出现 undefined reference to 'pthread_create' 错误

在编译中要加 -lpthread参数
g++ thread.c -o thread -lpthread

gcc thread.c -o thread -lpthread

特此备忘

原文地址:https://www.cnblogs.com/gaojian/p/2651098.html