简体   繁体   English

Eclipse运行先前的程序

[英]Eclipse runs the previous program

I run this program and after that i get "Errors exists do you want to continue". 我运行该程序,然后得到“错误存在,您要继续吗”。 Then i click yes and i get "Hello world" in the console. 然后,单击“是”,然后在控制台中显示“ Hello world”。 Which was the project i ran previously. 这是我之前运行的项目。 Anybody knows what is the problem? 有人知道这是什么问题吗?

#include <iostream>
#include <typeinfo>
using namespace std;

int func() {
    return 42;
}

int main ( int argc, char ** argv ) {
    auto x = func();
    cout << x << endl;
    cout << typeid(x).name() << endl;
    return 0;
}

You may not have selected to run the right program. 您可能尚未选择运行正确的程序。 If you hover over the Run option in Eclipse, it'll give you a tool tip telling you what program it's going to run. 如果将鼠标悬停在Eclipse中的“运行”选项上,它将为您提供一个工具提示,告诉您它将运行什么程序。

EDIT: Click the drop-down next to the run option, and see if your current program is in the list. 编辑:单击运行选项旁边的下拉列表,然后查看当前程序是否在列表中。 If it isn't you need to make a run configuration for it. 如果不是,则需要对其进行运行配置。 If don't have a run configuration, to make one, you click the drop down next to run > Run Configurations... > double click C/C++ Application > and fill in the proper information. 如果没有运行配置,请单击运行旁边的下拉菜单>“运行配置...”>双击“ C / C ++应用程序”,然后填写正确的信息。 After that click finish, and select that run configuration. 之后,单击“完成”,然后选择该运行配置。

Go to the Project Explorer window, right click on your project and click on "Build Project". 转到“项目资源管理器”窗口,右键单击您的项目,然后单击“构建项目”。 Now click on the Run button at the top (The green play button at the top). 现在,单击顶部的“运行”按钮(顶部的绿色播放按钮)。 If you have errors, maybe its actually looking for the last build that ran without error. 如果有错误,也许它实际上是在寻找没有错误运行的最后一个版本。 Let me know what happened when you tried this so I can assist you further. 让我知道您尝试此操作时发生了什么,以便我进一步为您提供帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM