CMake 和 Eclipse CDT:启动失败。未找到二进制文件

发布于 2024-12-10 21:35:08 字数 216 浏览 0 评论 0原文

我的目标是将 CMake 与 Eclipse CDT 结合使用。 每个教程中的一个小 CMakeLists.txt 文件对我来说效果很好,并且 Eclipse 成功导入并构建了生成的项目。 但构建后,它看不到二进制文件(“启动失败。找不到二进制文件。”),因为它进入根项目目录,而不是在 Debug/ 或 Release/ 中(或者项目缺少一些元数据)。

如何构建 Eclipse 识别的可执行文件?

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

How to build executables recognized by Eclipse?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

豆芽 2024-12-17 21:35:08

您必须创建一个新的运行配置。
转到运行>;运行配置> C\C++ 应用程序
并按照说明进行操作,按下新配置按钮
如果您有示例 hello world 项目,您可以复制设置。

我在 C\C++ 应用程序下添加了 debug\"Program Name"

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.

I added debug\"Program Name" under C\C++ application

东走西顾 2024-12-17 21:35:08

我刚刚遇到了同样的错误,这就是我所做的:

必须选择正确的二进制解析器,以便 Eclipse 可以识别可执行文件:
选择项目,然后右键单击。

项目->属性->C/C++ 构建->设置->二进制解析器、PE Windows 解析器(或者如果您使用该编译器,则可以选择 Cygwin)。

这至少对我来说对交叉编译器有用。

在 Linux 中我使用 Elf 解析器。

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.

Project->Properties->C/C++ Build->Settings->Binary Parsers, PE Windows Parser (or you can select Cygwin if you use that compiler).

That worked for me at least for Cross compiler.

In Linux I use Elf parser.

烟沫凡尘 2024-12-17 21:35:08

首先您需要确保项目已经构建。您可以使用工具栏中的锤子图标来完成此操作。您可以选择构建调试版本或发布版本。如果您无法构建项目,那么问题是您没有安装编译器,或者 IDE 找不到编译器。

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

g++ --version

如果您已经安装了它(当您安装 XCode 工具时就会安装它),您可以看到其运行位置:

which g++

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

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

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

在此处输入图像描述

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.

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

g++ --version

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

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:

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文