0

我正在关注 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;
}
4

1 回答 1

0

我按照其他帖子中的说明找到了解决问题的方法:Eclipse C++ MinGW - Can not Launch Program <Terminated>第二个答案对我有用。

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

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

于 2019-01-15T23:52:56.533 回答