在Eclipse中运行C++程序出现"Launch failed. Binary not foud"和"Program file not Specified"的问题

时间:2022-10-24 10:21:13

办公室电脑XP下用eclipse建立一个test工程,本想使其可以在XP下的eclipse下运行起来!

但在装了MinGW后,却不能像家里的eclipse环境一样,可以顺利run起来。

不管怎么设置,要么出现"Launch failed. Binary not foud"问题,要么出现"Program file not Specified"问题;

初始以为是MinGW的问题,因为办公室里不能上网,所以就不能像在家里用的MinGW-5.1.6了(因为这需要联网下载一些包),而是用了Qt SDK中的MinGW;

后来在网上查了些资料,冒似有网友也出现了类似问题,摘录如下:

 

Using C++ in Eclipse - "Program file not Specified" problem 遇到的问题 跟这位仁兄的一样  不过我的是在Linux下的, 抄录如下,以滋怀念。

When we are using CDT to write C++ in Eclipse, you may encounter the following error: (I've set up a new C++ Hello World project)

Binary not found

在Eclipse中运行C++程序出现"Launch failed. Binary not foud"和"Program file not Specified"的问题


Or Program file not Specified

在Eclipse中运行C++程序出现"Launch failed. Binary not foud"和"Program file not Specified"的问题

So how can we solve it?

1. Right click the project, Properties->C/C++ Build->Settings->Binary Parser, Click on "PE Windows Parser" if you are a Windows user.

在Eclipse中运行C++程序出现"Launch failed. Binary not foud"和"Program file not Specified"的问题

2. Now in the Run configurations, you can choose your C/C++ Application (At first you may not find the binaries to run because eclipse does not know how to run this binary)

在Eclipse中运行C++程序出现"Launch failed. Binary not foud"和"Program file not Specified"的问题

 

上面解决办法中的第1步,好理解,而且也设置了,但第2步没太理解,因为没有出现如上图中的对话框界面。

后来仔细研究了下"Program file not Specified"问题含义,意思是说运行程序没有指定。

我的理解是在eclipse中没有指定*.exe运行程序。

在上面的第2步中,在test Default界面(即运行配置界面中)下,在C/C++ Appliaction一栏中点击Browse按钮,在项目工程目录下,找到Debug目录,然后选择test.exe文件(我的程序名是这个名字,应该是跟工程名一样的),确定后,点击应用并运行,可以了~~~

果然是因为在eclipse中没有指定运行程序的原因。

后回到家中,查看了自已电脑上eclise的test工程,的确在eclipse中有指定了,只不过是可能由于家里的eclipse版本较高(家里用的是eclipse SDK 3.7),这部分可能由eclipse自己完成了!

在Eclipse中运行C++程序出现"Launch failed. Binary not foud"和"Program file not Specified"的问题