C++ Eclipse CDT 无法构建 - 不确定出了什么问题(包括控制台)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7130552/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 16:29:42  来源:igfitidea点击:

Eclipse CDT can't build - not sure what's wrong (console included)

c++eclipsecompiler-constructioneclipse-cdt

提问by Peter Rasmussen

I'm now going to give c++ a try to see what this language have to offer. I'm having some trouble setting it all up though. I have downloaded Eclipse CDT and followed this guide : http://www.dcs.vein.hu/bertok/oktatas/cpp_by_eclipse/eclipse_for_cpp_on_windows.html#Install_gdb

我现在要尝试一下 C++,看看这种语言必须提供什么。但是我在设置它时遇到了一些麻烦。我已经下载了 Eclipse CDT 并遵循了本指南:http: //www.dcs.vein.hu/bertok/oktatas/cpp_by_eclipse/eclipse_for_cpp_on_windows.html#Install_gdb

I am using Windows 7 64bit.

我正在使用 Windows 7 64 位。

I have never installed a compiler before, and I'm not sure what exactly I am doing wrong. It gives me an "Launch failed. no binary found" error when I try to run my program. However there is no binaries folder. I have tried building, it loads for a while, but nothing really happens.

我以前从未安装过编译器,我不确定我到底做错了什么。当我尝试运行我的程序时,它给了我一个“启动失败。没有找到二进制文件”错误。但是没有二进制文件夹。我试过构建,它加载了一段时间,但实际上什么也没发生。

Any idea what to do? I am completely new at c++ so please be patient and let me know if there's anything I am missing :)

知道该怎么做吗?我是 C++ 的新手,所以请耐心等待,如果有什么我遗漏的地方,请告诉我:)

The console in eclipse says the following:

eclipse 中的控制台显示如下:

Build of configuration Debug for project Test2 **

项目Test2的配置调试的构建**

Internal Builder is used for build ** cl /c /EHs /MD /Zi /nologo /Fospam.obj ..\spam.cpp Internal Builder: Cannot run program "cl" (in directory "C:\cppworkspace\Test2\Debug"): CreateProcess error=2, Den angivne fil blev ikke fundet Error: Program "cl" is not found in PATH

内部构建器用于构建 ** cl /c /EHs /MD /Zi /nologo /Fospam.obj ..\spam.cpp 内部构建器:无法运行程序“cl”(在目录“C:\cppworkspace\Test2\Debug "): CreateProcess error=2, Den angivne fil blev ikke fundet 错误:在 PATH 中找不到程序 "cl"

PATH=[C:\oraclexe\app\oracle\product\10.2.0\server\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\EgisTec\MyWinLocker 3\x86;C:\Program Files (x86)\EgisTec\MyWinLocker 3\x64;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\TortoiseSVN\bin;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;c:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\MinGW\bin] Build error occurred, build is stopped Time consumed: 156 ms.

PATH=[C:\oraclex\app\oracle\product\10.2.0\server\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows; C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\EgisTec\MyWinLocker 3\x86;C:\Program Files (x86)\EgisTec\ MyWinLocker 3\x64;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\TortoiseSVN\bin;c:\Program Files (x86)\Microsoft SQL Server\100\ Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;c:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\MinGW\bin] 发生构建错误,构建停止时间消耗:156 毫秒。

采纳答案by john

The problem is simple enough, Eclipse can't find your compiler.

问题很简单,Eclipse 找不到你的编译器。

On the lengthy PATH that is quoted I don't see 'c:\MinGW\bin' so I'm guessing you had problems with step 4 under section install MinGW.

在引用的冗长 PATH 中,我没有看到“c:\MinGW\bin”,所以我猜你在安装 MinGW 部分下的步骤 4 中遇到了问题。

Having said all that I don't think Eclipse is a very good environment for developing C++ and I don't think MinGW is a particularly good compiler. I'd seriously recommend you take a look at Visual C++ 2010 Express, which you can download from here http://www.microsoft.com/visualstudio/en-us/products/2010-editions/express

说了这么多,我不认为 Eclipse 是开发 C++ 的一个很好的环境,我也不认为 MinGW 是一个特别好的编译器。我强烈建议您查看 Visual C++ 2010 Express,您可以从这里下载http://www.microsoft.com/visualstudio/en-us/products/2010-editions/express

EDIT

编辑

OK now I do see 'c:\MinGW\bin', so apologies for that. I think the likely explanation is that you have selected the wrong 'tool chain'. Eclipse thinks you want to build with Visual C++ but you have downloaded MinGW. But really get Visual C++ 2010 Express and forget about Eclipse, it's much easier.

好的,现在我确实看到了 'c:\MinGW\bin',所以很抱歉。我认为可能的解释是您选择了错误的“工具链”。Eclipse 认为您想使用 Visual C++ 进行构建,但您已经下载了 MinGW。但真正获得 Visual C++ 2010 Express 而忘记 Eclipse,它会容易得多。

回答by eTiTan

If you will compile with Eclipse CDT + MingGW Compiler you should use the MinGW toolchain

如果您将使用 Eclipse CDT + MingGW Compiler 进行编译,则应使用 MinGW 工具链

MingW Toolchain

MingW 工具链

If you want use Eclipse + Microsoft C++ compiler, need change for "Microsoft Visual C++" toolchain and put in PATH

如果要使用 Eclipse + Microsoft C++ 编译器,需要更改“Microsoft Visual C++”工具链并放入 PATH

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin

or whatever you have because CL program is there...

或者你拥有的任何东西,因为 CL 程序在那里......