CMake 和 Eclipse CDT:启动失败。找不到二进制文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7838705/
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
CMake and Eclipse CDT: Launch failed. Binary not found
提问by Igor Shalyminov
My goal is to use CMake with Eclipse CDT. A tiny CMakeLists.txt file from every tutorial works well for me, and Eclipse succesfully imports and builds the generated project. But after building it doesn't see the binary ("Launch failed. Binary not found.") because it goes into the root project directory, not in Debug/ or Release/ (or the project lacks some metadata).
我的目标是将 CMake 与 Eclipse CDT 一起使用。每个教程中的一个小 CMakeLists.txt 文件对我来说效果很好,Eclipse 成功地导入并构建了生成的项目。但是在构建后它没有看到二进制文件(“启动失败。找不到二进制文件。”)因为它进入了根项目目录,而不是在 Debug/ 或 Release/ (或者项目缺少一些元数据)。
How to build executables recognized by Eclipse?
如何构建 Eclipse 识别的可执行文件?
回答by Harry Moreno
you have to create a new run configuration.
go to run > run configurations > C\C++ Application
and follow instructions, press the new configuration button
if you have the example hello world project you can copy the setup.
您必须创建一个新的运行配置。转到run > run configurations > C\C++ Application
并按照说明操作,如果您有示例 hello world 项目,请按新配置按钮,您可以复制设置。
I added debug\"Program Name"
under C\C++ application
我debug\"Program Name"
在 C\C++ 应用程序下添加
回答by Nenad Bulatovic
I just had the same error, and here is what I did:
我刚刚遇到了同样的错误,这就是我所做的:
Proper binary parser must be selected so Eclipse can recognize the executable: Select the project, then right click.
必须选择正确的二进制解析器,以便 Eclipse 能够识别可执行文件:选择项目,然后右键单击。
Project->Properties->C/C++ Build->Settings->Binary Parsers, PE Windows Parser (or you can select Cygwin if you use that compiler).
Project->Properties->C/C++ Build->Settings->Binary Parsers、PE Windows Parser(或者,如果您使用该编译器,则可以选择 Cygwin)。
That worked for me at least for Cross compiler.
这至少对交叉编译器对我有用。
In Linux I use Elf parser.
在 Linux 中,我使用 Elf 解析器。
回答by ceiroa
First you need to make sure that the project has been build. You can do that 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 文件夹中)。您的启动配置应如下所示: