Eclipse 中的“程序不是可识别的可执行文件”错误

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

"Program is not a recognized executable" error in Eclipse

c++eclipse

提问by Andreas

I'm trying to debug a C++ programme in Eclipse Indigo. The project is using autotools/configure (and the respective plugin) as build system.

我正在尝试在 Eclipse Indigo 中调试 C++ 程序。该项目使用 autotools/configure(和相应的插件)作为构建系统。

After successful build I right-clicked on the binary in the project browser and chose "Debug As". Then I used the file browser to select the binary. Clicking on "Debug" then opens a dialog which just says "program is not a recognized executable".

成功构建后,我右键单击项目浏览器中的二进制文件并选择“调试为”。然后我使用文件浏览器选择二进制文件。单击“调试”,然后打开一个对话框,上面只显示“程序不是可识别的可执行文件”。

Any ideas?

有任何想法吗?

回答by Andreas

I found the answer: the binary parsers configured in eclipse were the wrong ones. Adding the correct binary parser under Project --> Properties --> C/C++ Build --> Settings solves he problem.

我找到了答案:eclipse 中配置的二进制解析器是错误的。在 Project --> Properties --> C/C++ Build --> Settings 下添加正确的二进制解析器即可解决问题。

回答by Pierre Bourdon

If you're using libtoolin your project, what looks like the binary may actually be a wrapper script used to set LD_LIBRARY_PATHand stuff like that before executing the real binary (which is stored in the .libsdirectory). This may be what causes Eclipse to fail, but I'm not sure how you should go about fixing that.

如果你libtool在你的项目中使用,看起来二进制文件实际上可能是一个包装脚本,用于LD_LIBRARY_PATH在执行真正的二进制文件(存储在.libs目录中)之前进行设置和类似的东西。这可能是导致 Eclipse 失败的原因,但我不确定您应该如何解决这个问题。

There seem to be a bit of documentation about Eclipse CDT and libtoolon the internet which may have the infos you need though: http://www.freerdp.com/wiki/doku.php?id=eclipse#debug_configuration

似乎有一些关于 Eclipse CDT 的文档和libtool互联网上可能有你需要的信息:http: //www.freerdp.com/wiki/doku.php?id=eclipse#debug_configuration

回答by Humble Learner

From OSX snow leopard on, gcc seems to build 64 bit executables by default. And those won't be recognized from Eclipse in return. To solve the error, you've got to explicitly set your architecture to i386.

从 OSX 雪豹开始,gcc 似乎默认构建 64 位可执行文件。而这些不会被 Eclipse 识别作为回报。要解决该错误,您必须将架构显式设置为 i386。

Enter your project properties and add the command line option “-arch i386″ for each C++ Linker, C++ Compiler and C Compiler. After a clean build, you should be clear to debug again. In Linker options make sure to NOT set it up as -Xlinker option.

输入您的项目属性并为每个 C++ 链接器、C++ 编译器和 C 编译器添加命令行选项“-arch i386”。在干净的构建之后,您应该清楚再次调试。在链接器选项中确保不要将其设置为 -Xlinker 选项。

Original Source

原始来源