Eclipse- C/C++ <终止,退出值:-1073741515>

Eclipse- C/C++ <terminated, exit value: -1073741515>

本文关键字:退出 -1073741515 gt 终止 C++ lt Eclipse-      更新时间:2023-10-16

我最近决定学习C/c++,为几个月后的编程课做准备,所以我下载并安装了Eclipse。当我在浏览HelloWorld项目的教程时,我遇到了一个问题,即使代码编译得很好,控制台也不会输出"HelloWorld!"当我运行调试器时,它说它被终止,退出值是-1073741515,然后是我的目录"C:UsersExampleworkspaceHelloWorldDebugHelloWorld.exe",然后是日期和时间。

我安装了MinGW,我将eclipse的路径设置为C:MinGWbin,这是它在我的目录中的位置,我检查了以确保我的偏好是正确的,因为在此之前我有一些"程序g++未在path中找到"answers"程序gcc未在path中找到"这些错误在我更改环境变量时被修复。

当我继续遵循教程,以及包含以下代码的HelloWorld.cpp时

#include <iostream>
using namespace std;
int main() {
    cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
    return 0;
}

接下来,他们让我写一个main.cpp,其中包含以下代码

#include <iostream>
using namespace std;
int main() {
    // Say Helloworld five times
    for (int index = 0; index < 5; ++index)
        cout << "HellowWorld!" << 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;

}

最后,他们告诉我创建一个makefile来帮助构建和运行我的项目,其中包含以下代码:

all: hello.exe
clean: 
    rm main.o hello.exe
hello.exe: main.o
    g++ -g -o hello main.o
main.o:
    g++ -c -g main.cpp

这个程序应该做的是在控制台中打印五次"HelloWorld!",但它不是,只是返回"终止,退出值:-1073741515",我真的很困惑为什么会这样。有人能帮帮我吗?谢谢大家。

我有一些使用Eclipse C/c++的经验

我建议的第一件事是你通过启动一个新项目来做一个测试,然后点击'new hello world'选项,而不是'empty project',这应该会设置你的所有项目。-当你完成这些后,你应该能够使用Eclipse中的按钮运行程序。

如果它工作,你就完成了-你可以修改程序到任何你想要的,一切都是为你做的。

如果它不起作用,则有问题,很可能是Eclipse找不到编译器。当您启动一个新项目时,您可能能够告诉它,因为它将在启动项目窗口的右侧显示它找到的编译器。

希望这对你有帮助。根据我的经验,Eclipse真的很棒,但是有太多的选项,它可能有点令人生畏,我知道我没有充分利用它的潜力。

如果你真的被困住了,试试使用PELLES而不是Eclipse——在我的经验中,这更容易上手。

您的路径设置可能没有传递到您的工具链。为了确保这一点,将MinGW二进制文件夹的完整路径添加到Windows路径中,然后重新启动。(Cygwin的二进制文件夹(C:Cygwin64bin,在我的系统中))