Mik*_*ike 4 c++ linux multithreading system-calls undefined-reference
我是posix线程库的新手,我尝试从教程中编译示例代码:
g++ -lpthread agreement.cpp -o agreement
Run Code Online (Sandbox Code Playgroud)
但是我无法编译代码并收到以下错误消息:
a3q2.cpp:(.text+0x7e): undefined reference to `sem_open'
a3q2.cpp:(.text+0xab): undefined reference to `sem_wait'
a3q2.cpp:(.text+0x290): undefined reference to `sem_post'
a3q2.cpp:(.text+0x2af): undefined reference to `sem_close'
a3q2.cpp:(.text+0x2bb): undefined reference to `sem_unlink'
collect2: ld returned 1 exit status
make: *** [a3q2_exe] Error 1
Run Code Online (Sandbox Code Playgroud)
我知道编译工作需要-lpthread,但是我可能还需要其他任何选项才能解决问题吗?如果不是我如何安装"正确的"pthread库?
谢谢你的帮助!
| 归档时间: |
|
| 查看次数: |
13368 次 |
| 最近记录: |