Eclipse项目运行问题
我尝试在 Eclipse Helios 中创建一个 C++ 项目,它对于一些简单的“Hello World”项目(单个文件等)运行良好。但是,现在我有一个更大的项目,有几个文件,该项目仍然可以毫无问题地构建。实际上,当我进入发布文件夹时,makefile、目标文件、实际的二进制可执行文件都在那里。我可以通过终端运行二进制文件。如果我在 Eclipse 中单击该项目的“运行/调试”,它总是显示“启动失败。找不到二进制文件”。
如何在Eclipse中运行该程序?我想探索它的调试功能。另外,我在 CentOS linux 上运行 eclipse,我相信基本的 g++、gdb 设置等应该没问题,否则守护进程 hello world
将无法工作。
I tried to create a C++ project in Eclipse Helios, it works fine for some simple "Hello World" projects (a single file etc..). However, now I have a little bigger project with several files, the project can still be built without any problems. Actually, when I get into the release folder, the makefile, object files, the actual binary executable are all there. And I could run the binary through the termainl. If I click the "Run/Debug" in Eclipse for this project, it always says "Launch Failed. Binary not found".
How could run the program in Eclipse? I would like to explore its debug features. In addition, I'm running eclipse in CentOS linux and I believe the basic g++, gdb setting etc.. should be all right, otherwise the daemon hello world
won't work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
警告:我的 eclipse 和 CDT 版本非常旧,因此当前过程可能已发生很大变化。
在
C/C++ Project
视图中,展开您的项目,然后展开二进制文件
节点。在那里你应该有一个构建的可执行文件的列表。右键单击它并选择项目Run As.. >本地 C/C++ 应用程序
。这应该会自动创建一个新的运行配置,您可以从工具栏中的绿色箭头图标和小错误图标访问该配置。单击这些可正常运行或以调试模式运行。如果您想调整程序的启动方式,请转到绿色箭头图标的
运行配置
菜单项。选择您之前创建的配置或创建一个新配置。然后,您可以调整各种启动设置,例如要运行的可执行文件、要传递的参数、所需的环境变量等。请注意,还有一个单独的
调试配置
,可以从小工具栏中的错误图标。在该对话框中,有一个“调试器”选项卡,其中包含设置调试器所需的所有控件。只需随机调整控件,直到找到适合您的东西。Warning: I have a very old version of eclipse and the CDT so the current procedure could have changed considerably.
In the
C/C++ Project
view, expand your project then expand theBinaries
node. In there you should have a list of the built executables. Right-click on it and select the itemRun As.. > Local C/C++ Application
. This should automatically create a new run configuration which you can access from the green arrow icon and the little bug icon in your tool bar. Click on these to run normally or to run in debug mode.If you want to tweak how programs are launched, goto to the
Run configuration
menu item of the green arrow icon. Select the configuration that you previously created or make a new one. You can then tweak the various launch settings like the executable to run, the arguments you want to pass, the required environment variables, etc.Note that there's also a separate
Debug configuration
that can be accessed from the little bug icon in your toolbar. Within that dialog there's aDebugger
tab which contains all the controls necessary to set up your debugger. Just randomly screw around with the controls until you find something that works for you.我刚刚遇到了同样的错误,这就是我所做的 - 必须选择正确的二进制解析器,以便 Eclipse 可以识别可执行文件:
选择项目,然后右键单击。
项目->属性->C/C++构建->设置->二进制解析器,PE Windows解析器
(或者如果你使用Cygwin编译器,可以选择Cygwin解析器,在Linux上我使用Elf解析器)。
这至少对我的交叉编译器有用(在 Windows 7 和 Ubuntu 12.04 上)
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 parser if you use Cygwin compiler, on Linux I use Elf parser).
That worked for me at least for Cross compiler (both on Windows 7 and Ubuntu 12.04)