对‘pthread_create’未定义的引用

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

gcc example.c -lpthread -o example

注意:是小写的l


posted @ 2014-07-22 16:16  bzyzhang  阅读(513)  评论(0编辑  收藏  举报