【问题标题】:Cannot Run As a c++ project in eclipse无法在 Eclipse 中作为 c++ 项目运行
【发布时间】:2014-12-27 11:43:42
【问题描述】:

我在尝试在 Eclipse 中运行 c++ 项目时遇到问题。

我找到了几页有解决方案的页面,但没有一个有效。

The program file specified in the launch configuration does not exist

Launch Failed. Binary not found. CDT on Eclipse Helios

程序编译:

08:52:36 **** Build of configuration Debug for project testcpp ****
make all 
Building file: ../test.cpp
Invoking: Cross G++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -std=c++11 -MMD -MP -MF"test.d" -MT"test.d" -o "test.o" "../test.cpp"
Finished building: ../test.cpp

Building target: testcpp.exe
Invoking: Cross G++ Linker
g++ -pthread -o "testcpp.exe"  ./test.o   
Finished building target: testcpp.exe


08:52:38 Build Finished (took 1s.664ms)

并且文件testcpp.exe 在调试文件夹中,但是当我运行Run as -> Local C/c++ Application 它显示错误Launch Failed. Binary not found.

问题是我只需点击Run 就可以了。

有什么想法吗?

Eclipse 版本:

面向 C/C++ 开发人员的 Eclipse IDE

版本:Luna Service Release 1 (4.4.1) 内部版本号:20140925-1800

平台: Windows 7 64 位。

【问题讨论】:

  • 文本“Invoking: Cross G++ Compiler”让我猜测您正在为另一个目标而不是您所在的本机平台制作程序。因此,当您尝试作为“本地应用程序”运行时,它会尝试以本机方式运行程序,但事实并非如此。当您“运行”它时,您可能会在某种模拟器中启动它。请注意,我只是在猜测,因为我已经很多年没有使用过 Eclipse。
  • 您使用哪个平台?如果在 windows 上运行 g++,交叉编译可能有意义
  • 是的,我在 windows 上运行,目标是跨 g++,因为它是我唯一可以使用 -pthread 运行的。我将使用此信息更新问题。

标签: c++ eclipse


【解决方案1】:

一种廉价的技巧可能是将您的调试文件夹添加到您的 PATH 环境变量中。这样 eclipse 也会检查二进制文件的路径。

如果其他人编写了 makefile(不是 eclipse),那么 eclipse 可能不知道调试路径。尝试指定要启动的完整路径

【讨论】:

  • 谢谢。这行得通,但这是正确的方法吗?或者我应该以特殊的方式配置eclipse?
  • 我手头没有任何 Eclipse 应用程序,但在运行中,因为有一个地方可以指定二进制文件的位置。这实际上取决于您的项目是如何创建的
猜你喜欢
  • 2014-01-11
  • 1970-01-01
  • 1970-01-01
  • 2021-08-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-12-22
  • 1970-01-01
相关资源
最近更新 更多