【问题标题】:Why does C++ "Hello World" require pthread (which is missing) in Eclipse Mars?为什么 C++“Hello World”在 Eclipse Mars 中需要 pthread(缺少)?
【发布时间】:2016-08-25 20:25:41
【问题描述】:

我已经运行 Eclipse Juno 和 MinGW 4.6.2 很长时间了,但我需要完整的 C++11 支持,所以我升级到 Eclipse Mars 并将 MinGW 4.9.3 安装在不同的目录中。

在 Mars 中,链接任何可执行文件 - 即使在 C++ Hello World 项目中 - 都会导致“C:\MinGW_4_9_4\bin...\ld.exe: cannot find -lpthread.”

4.6.2 目录(用于 Juno)包含 pthread,但 4.9.3 目录(用于 Mars)不包含。

Mars 为什么以及如何尝试链接到 pthread? (我可以关掉它吗?)

【问题讨论】:

    标签: eclipse c++11 pthreads mingw


    【解决方案1】:

    我无法确定是否可以链接 w/o pthread,但我注意到在我安装(并重新安装 w/maxmium 选项)MinGW 4.9.3 后 pthread 不存在。可能是安装程序的错误?

    在 2008 年,MinGW 说“使用 sourceware.org 的 pthreads-win32 风险自负”。我现在看到 mingw-pthreads-win32 是 MinGW 安装管理器设置工具 (mingw-get.exe) 中的标准库。我对 MinGW 对 Win-32 的纯粹态度感到满意,所以我安装了该库。万岁 - 问题解决了! ld.exe 现在可以找到 -lpthread。

    您可以在 MinGW 安装管理器设置工具的左侧窗格中的“所有包/MinGW/MinGW 库/MinGW 标准库”下找到该包;它是右侧窗格中的“mingw-pthreads-win32”包(“dev”类)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-02-23
      • 2011-09-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-21
      • 1970-01-01
      • 2015-05-07
      相关资源
      最近更新 更多