Eclipse C ++调试器不会在断点处停止,而是在调试开始后立即终止

时间:2019-01-15 01:30:05

标签: c++ eclipse debugging eclipse-photon

我正在遵循Eclipse Photon文档中的C ++调试教程部分(https://help.eclipse.org/photon/index.jsp)。我已经按照所有说明创建了第一个C ++项目,并且位于“调试项目”部分。我的问题是,在创建调试透视图并单击“调试”按钮后,调试器永远不会在设置的断点处停止。在“调试”窗口中,它只是说而已,程序循环甚至根本不产生任何输出。如果正常运行程序,则循环将打印到控制台,但是在调试透视图中没有任何反应。

我尝试删除调试透视图并创建一个新的透视图,但遇到了同样的问题。 我已经上传了调试配置的屏幕截图。

https://imgur.com/a/MXYHxJl
https://imgur.com/a/eEU47Ht
https://imgur.com/a/koOf08x

#include <iostream>
using namespace std;

int main () {
    // Say HelloWorld five times
    for (int index = 0; index < 5; ++index)
      cout << "HelloWorld!" << endl;
    char input = 'i';
    cout << "To exit, press 'm' then the 'Enter' key." << endl;
    cin  >> input;
    while(input != 'm') {
        cout << "You just entered '" << input << "'. "
             << "You need to enter 'm' to exit." << endl;
        cin  >> input;
    }
    cout << "Thank you. Exiting." << endl;
    return 0;
}

1 个答案:

答案 0 :(得分:0)

我按照另一篇文章中的说明找到了解决问题的方法:Eclipse C++ MinGW - Can not Lauch Program <Terminated>第二个答案对我有用。

我必须右键单击我的项目-->属性-->运行/调试设置-->单击启动配置,然后单击“编辑”。进入编辑屏幕后,点击“环境”标签,然后添加以下变量 名称=路径 VALUE =%PATH%; C:\ MINGW / BIN

我在环境中未设置任何内容,更改为上述设置使调试器在程序内的正确断点处停止。