C++ Eclipse SDL 构建错误:“启动配置中指定的程序不存在”

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

Eclipse SDL build error: "The program specified in the launch configuration does not exist"

c++eclipse

提问by Bugster

I've tried working some SDL on my set-up eclipse, and as I tried running it it gave me the following error:

我试过在我的设置 eclipse 上使用一些 SDL,当我尝试运行它时,它给了我以下错误:

  'Launching SDL.exe' has encountered a problem.
  The program specified in the launch configuration does not exist

I instantly went to another project to see if it builds, and it did. I also tried re-building, debugging the SDL project. I don't know if it's an error in code but just in case, this is the code:

我立即去了另一个项目,看看它是否成功,结果确实如此。我还尝试重新构建、调试 SDL 项目。我不知道这是否是代码错误,但以防万一,这是代码:

#include "SDL/SDL.h"
#include <string>
#include <SDL/SDL_image.h>

SDL_Surface *load_image( std::string filename ) {
    SDL_Surface* loadedImage = NULL;
    SDL_Surface* optimizedImage = NULL;

    loadedImage = IMG_Load(filename.c_str());
    if(loadedImage != NULL) {
        optimizedImage = SDL_DisplayFormat(loadedImage);
        SDL_FreeSurface(loadedImage);
    }
    return optimizedImage;
}

I've googled it, and there's a duplicate question on stackOverFlow here, however it has 0 answers, not even a comment. There are no answers on google regarding this problem, so if you'd answer it, you'd probably solve hours of headaches for more people.

我在谷歌上搜索这里有一个关于 stackOverFlow 的重复问题,但它有 0 个答案,甚至没有评论。谷歌上没有关于这个问题的答案,所以如果你回答它,你可能会为更多人解决数小时的头痛问题。

回答by Yan Huang

I encountered the same problem with eclipse in Ubuntu. Spent 30 minutes and finally got it fixed as below:

我在 Ubuntu 中遇到了同样的 eclipse 问题。花了 30 分钟,终于把它修复如下:

  • Click Project -> Properties;
  • Select run/debug settings, and then the current configuration on the right pane, click edit;
  • In the c/c++ application textbox, select search project, and then click the binary you want to execute for the current project.
  • 点击Project -> Properties;
  • 选择run/debug settings,然后在右侧窗格中选择当前配置,单击edit
  • 在 c/c++ 应用程序文本框中,选择search project,然后单击要为当前项目执行的二进制文件。

On my system, the previous problem is due to incorrect default file name --- the linker generates abinary.exebut in run configuration it is "abinary".

在我的系统上,上一个问题是由于不正确的默认文件名 --- 链接器生成abinary.exe但在运行配置中它是“abi​​nary”。

Such tiny (but time consuming) problems should have been fixed by Eclipse developers, if they got well paid as MS or apple developers. Alas, free software?

如果 Eclipse 开发人员作为 MS 或 Apple 开发人员获得了丰厚的报酬,那么这些微小(但耗时)的问题就应该由 Eclipse 开发人员解决。唉,自由软件?

回答by Yaroslav

Right click on your project in the Project Explorer and select Debug As-> Local C/C++ Application.

在 Project Explorer 中右键单击您的项目,然后选择Debug As-> Local C/C++ Application

回答by Stuart

Check to make sure you didn't accidentally hit a space first, when typing in the project name. Also, if on windows use CMD or Linux ls -al your workspace and look carefully at the columns of names. Try executing your .exe from the command line. If it's not there, well, look at your build output more closely! :-)

在输入项目名称时,先检查以确保您没有不小心碰到空格。此外,如果在 Windows 上使用 CMD 或 Linux ls -al 您的工作区并仔细查看名称列。尝试从命令行执行您的 .exe。如果它不存在,那么,请更仔细地查看您的构建输出!:-)

回答by Atmadeep Arya

I'm using Eclipse Neon. In my case I was copy pasting a code to understand enumerator, but the code was faulty. As I built the project, the binaries disappeared and it said:

我正在使用 Eclipse Neon。就我而言,我是复制粘贴代码来理解枚举器,但代码有问题。当我构建项目时,二进制文件消失了,它说:

the program file in launch configuration does not exist

启动配置中的程序文​​件不存在

Then I tried a simple hello world program and it still gave an error. The actual problem was that the srcfolder had both the files (I don't know how). When I deleted the other one it built and ran successfully. Hope this helped.

然后我尝试了一个简单的 hello world 程序,它仍然报错。实际问题是该src文件夹包含两个文件(我不知道如何)。当我删除另一个时,它构建并成功运行。希望这有帮助。