为什么C ++和"Hello World"需要Eclipse Mars中的pthread(缺少)? [英] Why does C++ "Hello World" require pthread (which is missing) in Eclipse Mars?

查看:107
本文介绍了为什么C ++和"Hello World"需要Eclipse Mars中的pthread(缺少)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经运行Eclipse Juno和MinGW 4.6.2很长时间了,但是我需要完整的C ++ 11支持,因此我升级到了Eclipse Mars,并在另一个目录中安装了MinGW 4.9.3.

I've been running Eclipse Juno and MinGW 4.6.2 for a long time, but I need full C++11 support so I upgraded to Eclipse Mars and installed MinGW 4.9.3 in a different directory.

在Mars中,即使在C ++ Hello World项目中链接任何可执行文件,也会导致"C:\ MinGW_4_9_4 \ bin ... \ ld.exe:找不到-lpthread."

In Mars, linking any executable - even in the C++ Hello World project - results in "C:\MinGW_4_9_4\bin...\ld.exe: cannot find -lpthread."

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

The 4.6.2 directory (for Juno) contains pthread, but the 4.9.3 directory (for Mars) does not.

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

Why and How is Mars trying to link to pthread? (Can I turn it off?)

推荐答案

我无法确定是否可以不带pthread进行链接,但是我注意到在安装(并重新安装后)pthread不存在w/maximium选项)MinGW 4.9.3.也许是安装程序错误?

I couldn't determine if it's possible to link w/o pthread, but I'd noticed that pthread was not present after I installed (and re-installed w/maxmium options) MinGW 4.9.3. Maybe it's an installer bug?

2008年,MinGW说:使用Sourceware.org的pthreads-win32需要您自担风险".我现在看到mingw-pthreads-win32是MinGW Installation Manager设置工具(mingw-get.exe)中的标准库.我对MinGW对于Win-32的纯粹态度感到满意,因此我安装了该库.万岁-问题解决了!ld.exe现在可以找到-lpthread.

In 2008, MinGW said "Use sourceware.org's pthreads-win32 at your own risk". I now see mingw-pthreads-win32 is a standard library in the MinGW Installation Manager Setup Tool (mingw-get.exe). I feel save with MinGW's purist attitude regarding Win-32, so I installed the library. Hooray - problem solved! ld.exe can now find -lpthread.

您可以在MinGW Installation Manager设置工具的左窗格中的所有软件包/MinGW/MinGW库/MinGW标准库"下找到该软件包;这是右窗格中的"mingw-pthreads-win32"包("dev"类).

You can find the package in the MinGW Installation Manager Setup Tool, under "All Packages/MinGW/MinGW Libraries/MinGW Standard Libraries" in the left pane; it's the "mingw-pthreads-win32" package ("dev" class) in the right pane.

这篇关于为什么C ++和"Hello World"需要Eclipse Mars中的pthread(缺少)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆