【发布时间】:2012-01-06 01:46:23
【问题描述】:
我的系统中安装了 ubuntu 11。我有一个使用 pthread 库的 c 程序。
即使我使用标志-lpthread 编译,我也会收到错误Undefined reference to sem_wait()。
例如:
gcc -lpthread prog.c
该程序在其他 ubuntu 安装上运行良好。
【问题讨论】:
-
你能尝试用 pthread 调用编译其他东西吗?
-
链接顺序很重要。图书馆只能在最后。
标签: c++ c multithreading gcc operating-system