关于线程-lpthread问题

pthread_create函数编译时报错:undefined reference to 'pthread_create'
由于pthread 库不是 Linux 系统默认的库,所以在编译使用pthread_create()创建线程的程序时,需要显式指定 -lpthread参数。

例如:
gcc thread.c -o thread -lpthread
posted @ 2022-01-03 02:01  suphgcm  阅读(194)  评论(0)    收藏  举报