C++ 启动失败。未找到二进制文件。Eclipse Helios 上的 CDT

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4971926/
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 17:03:36  来源:igfitidea点击:

Launch Failed. Binary not found. CDT on Eclipse Helios

c++ceclipseeclipse-plugineclipse-cdt

提问by rogcg

I'm using Eclipse Helios on Ubuntu 10.04, and I'm trying to install CDT plugin on it. I download it from here here.

我在 Ubuntu 10.04 上使用 Eclipse Helios,我正在尝试在其上安装 CDT 插件。我从这里下载它这里

And then I go to Install New Softwareand select the zip file (I don't extract it, just select the zip file). And its ok, it installs, everything works fine, it shows optional features, blah blah blah.

然后我去安装新软件并选择 zip 文件(我不解压它,只选择 zip 文件)。没关系,它安装,一切正常,它显示可选功能,等等

And then I create a new HelloWorld project. And when I try to run it, it shows an error and says:

然后我创建了一个新的 HelloWorld 项目。当我尝试运行它时,它显示一个错误并说:

Launch failed. Binary not found.

启动失败。未找到二进制文件。

Can anyone explain me how to fix it?

谁能解释我如何解决它?

Thanks.

谢谢。

回答by varunthacker

You must build an executable file before you can run it. So if you don't “BUILD” your file, then it will not be able to link and load that object file, and hence it does not have the required binary numbers to execute.

您必须先构建一个可执行文件,然后才能运行它。因此,如果您不“构建”您的文件,那么它将无法链接和加载该目标文件,因此它没有执行所需的二进制数。

So basically right click on the Project -> Build Project -> Run As Local C/C++ Applicationshould do the trick

所以基本上右键单击Project -> Build Project -> Run As Local C/C++ Application应该可以解决问题

回答by ceiroa

First you need to make sure that the project has been built. You can build a project with the hammer icon in the toolbar. You can choose to build either a Debug or Release version. If you cannot build the project then the problem is that you either don't have a compiler installed or that the IDE does not find the compiler.

首先,您需要确保项目已构建。您可以使用工具栏中的锤子图标构建项目。您可以选择构建 Debug 或 Release 版本。如果您无法构建项目,则问题是您没有安装编译器或 IDE 找不到编译器。

To see if you have a compiler installed in a Mac you can run the following command from the command line:

要查看 Mac 中是否安装了编译器,您可以从命令行运行以下命令:

g++ --version

If you have it already installed (it gets installed when you install the XCode tools) you can see its location running:

如果你已经安装了它(它在你安装 XCode 工具时安装)你可以看到它的位置正在运行:

which g++

If you were able to build the project but you still get the "binary not found" message then the issue might be that a default launch configuration is not being created for the project. In that case do this:

如果您能够构建项目,但仍然收到“找不到二进制文件”消息,则问题可能是未为项目创建默认启动配置。在这种情况下,请执行以下操作:

Right click project > Run As > Run Configurations... > 

Then create a new configuration under the "C/C++ Application" section > Enter the full path to the executable file (the file that was created in the build step and that will exist in either the Debug or Release folder). Your launch configuration should look like this:

然后在“C/C++ 应用程序”部分下创建一个新配置 > 输入可执行文件的完整路径(在构建步骤中创建的文件,将存在于 Debug 或 Release 文件夹中)。您的启动配置应如下所示:

enter image description here

在此处输入图片说明

回答by Unmesh

Go to the Run->Run Configuration->now

转到运行->运行配置->现在

Under C/C++ Application you will see the name of your executable + Debug (if not, click over C/C++ Application a couple of times). Select the name (in this case projectTitle+Debug).

在 C/C++ 应用程序下,您将看到可执行文件的名称 + 调试(如果没有,请单击 C/C++ 应用程序几次)。选择名称(在本例中为 projectTitle+Debug)。

Under this in main Tab -> C/C++ application -> Search your project-> in binaries select your binary titled by your project....

主选项卡下 -> C/C++ 应用程序 -> 搜索您的项目-> 在二进制文件中选择由您的项目命名的二进制文件....

回答by situee

You must "build" before "run", otherwise "Binary not found". You can set up "Auto build", so that it will build and run. Check this post to set up "Auto build" http://situee.blogspot.com/2012/08/how-to-set-eclipse-cdt-auto-build.html

您必须在“运行”之前“构建”,否则“找不到二进制文件”。您可以设置“自动构建”,以便构建和运行。检查这篇文章以设置“自动构建” http://situee.blogspot.com/2012/08/how-to-set-eclipse-cdt-auto-build.html

回答by Takahashinator

I had this problem for a long while and I couldn't figure out the answer. I had added all the paths, built everything and pretty much followed what everyone on here had suggested, but no luck.

我有这个问题很长一段时间,我想不出答案。我已经添加了所有路径,构建了所有内容并且几乎遵循了这里每个人的建议,但没有运气。

Finally I read the comments and saw that there were some compilation errors that were aborting the procedure before the binaries and exe file was generated.

最后我阅读了评论,发现在生成二进制文件和 exe 文件之前有一些编译错误正在中止程序。

Bottom line: Do a code review and make sure that there are no errors in your code because sometimes eclipse will not always catch everything.

底线:进行代码并确保您的代码中没有错误,因为有时 Eclipse 并不总是能捕获所有内容。

If you can run a basic hello world but not your code then obviously something is wrong with your code. I learned the hard way.

如果您可以运行基本的 hello world 而不是您的代码,那么显然您的代码有问题。我学会了艰难的方式。

回答by Denis Korzhenkov

If you still have an error even after building the project then try to do this:

如果在构建项目后仍然有错误,请尝试执行以下操作:

  • click on Binariesin Project Explorer with the left button
  • click on green "Play" button (Run Debug)
  • 使用左键单击Project Explorer 中的Binaries
  • 单击绿色的“播放”按钮(运行调试)

回答by Akshaya Kumar

I faced the same problem. I have Eclipse Indigo and Eclipse Luna on Ubuntu. I tried many solutions, but none worked. Here's how you can try :) Try it in order :)

我遇到了同样的问题。我在 Ubuntu 上有 Eclipse Indigo 和 Eclipse Luna。我尝试了很多解决方案,但没有一个奏效。这是您可以尝试的方法:) 按顺序尝试:)

  1. Either do Build All and then compile :)
  2. Install G++ Compiler
  3. Windows->Preferences->NEW CDT PRoject-> Makefile-> Binary Parsers-> Choose Cywin or Window PE depending on your Os :)
  4. Change your toolchain to cywin gcc
  5. Project->Properties->Environment-> Release Active
  1. 要么全部构建,然后编译:)
  2. 安装 G++ 编译器
  3. Windows->Preferences->NEW CDT PRoject-> Makefile-> Binary Parsers-> 根据您的操作系统选择 Cywin 或 Window PE :)
  4. 将您的工具链更改为 cywin gcc
  5. Project->Properties->Environment-> Release Active

After 1,2, 3, and 4, I tried changing paths, and other stuff, but nothing worked. In the end, I noticed that it mentioned Debug Active was not configured. So when I changed it to Release Active, it worked. Do note that change in environment and path is not required.

在 1、2、3 和 4 之后,我尝试更改路径和其他内容,但没有任何效果。最后,我注意到它提到未配置 Debug Active。因此,当我将其更改为 Release Active 时,它​​起作用了。请注意,不需要更改环境和路径。

回答by MyName

I was having this same problem and found the solution in the anwser to another question: https://stackoverflow.com/a/1951132/425749

我遇到了同样的问题,并在另一个问题的回答中找到了解决方案:https://stackoverflow.com/a/1951132/425749

Basically, installing CDT does not install a compiler, and Eclipse's error messages are not explicit about this.

基本上,安装 CDT 不会安装编译器,并且 Eclipse 的错误消息并未明确说明这一点。

回答by Weloo

I faced the same problem while installing Eclipse for c/c++ applications .I downloaded Mingw GCC,put its bin folder in your path,used it in toolchains while making new C++ project in Eclipse and buildwhich solved my problem. Referred to this video

我在为 c/c++ 应用程序安装 Eclipse 时遇到了同样的问题。我下载了Mingw GCC,将它的 bin 文件夹放在你的路径中,在工具链中使用它,同时在 Eclipse 中创建新的 C++ 项目并构建解决了我的问题。参考了这个视频

回答by Lyle Z

Seems like having "Build Automatically" under the Project menu ought to take care of all of this. It does for Java.

似乎项目菜单下的“自动构建”应该处理所有这些。它适用于 Java。