[转载]解决linux 下多线程错误 undefined reference to `sem_init'

转自:https://blog.csdn.net/yzycqu/article/details/7396498?utm_source=copy

解决linux 下多线程错误 undefined reference to `sem_init'

编译的时候出现如下错误提示:

undefined reference to `sem_init'
undefined reference to `sem_post'
undefined reference to `sem_wait'


编译选项需要加入一个多线程:

gcc -pthread -o outfile.out filename.c

posted @ 2019-02-18 16:16  workingdiary  阅读(555)  评论(0编辑  收藏  举报