我是 C 编程新手。
我试图使用 pthread API 编写一些并发程序。
我为 C/C++ 开发人员下载了 eclipse IDE,MinGW。我已经把所有的库,头文件放到了MinGW文件的相应位置。
当我尝试构建项目时,总是出现错误“找不到-lpthread”,这是怎么回事? 我已将“-pthread”添加到 GCC 编译器。
我在谷歌上搜索了很多,但似乎没有人遇到与我类似的问题。
最佳答案
this question 的答案由同样缺少 MinGW pthread 库的人应该可以帮助你!本质上,问题是 MinGW 安装程序脚本可能不会在安装时下载 lpthread 库。引用自链接:
Just run and open MinGW Installation Manager, which should be pre-installed with MinGW, select "All Packages" on the left panel, and on the right panel, search for "mingw32-pthreads-w32" packages and install them.
关于找不到 -lpthread?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21827392/