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

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

问题描述

我长久以来一直在运行Eclipse Juno和MinGW 4.6.2,但是我需要完整的C ++ 11支持,所以我升级到Eclipse Mars,并将MinGW 4.9.3安装在不同的目录中。



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



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



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

解决方案

我无法确定是否可以链接w / o pthread,但是'我注意到,在安装(和重新安装w / maxmium选项)MinGW 4.9.3之后,pthread不存在。也许这是一个安装程序错误?



2008年,MinGW说使用sourceware.org的pthreads-win32自己承担风险。我现在看到mingw-pthreads-win32是MinGW Installation Manager安装工具(mingw-get.exe)中的标准库。我觉得用MinGW对Win-32的纯粹主义态度保存下来,所以我安装了这个库。 Hooray - 问题解决了! ld.exe现在可以找到-lpthread。



您可以在MinGW Installation Manager安装工具中的All Packages / MinGW / MinGW Libraries / MinGW标准库下找到该软件包在左窗格中;它是右窗格中的mingw-pthreads-win32包(dev类)。


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.

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."

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

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

解决方案

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?

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.

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天全站免登陆