我开始学习 C++ 并编写了一个Hello World"程序.当我尝试在命令提示符下运行它时,它崩溃并给我一条 Windows 消息,说Hello World.exe 已停止工作.".
I've started learning C++ and wrote a "Hello World"-Program. When i try to run it in command prompt, it crashes and gives me a windows message saying "Hello World.exe has stopped working.".
代码:
#include <iostream>
#include <string>
int main()
{
std::string response;
std::cout << "Hallo Welt
";
std::cin >> response;
std::cout << "User: " << response;
return(0);
}
我使用 Eclipse IDE 和 MinGW 作为编译器.我已经在环境变量中设置了MinGW/bin的路径.在我将 MinGW/bin 目录中的所有 dll 复制到 Hello World.exe 的文件夹中后,程序运行顺利.因此,似乎需要这些 dll 的任何东西都无法正确访问它们.我想省去为我创建的每个项目复制 dll 的麻烦.有什么办法可以解决这个问题吗?
I'm using Eclipse IDE and MinGW as compiler. I've already set the path of MinGW/bin in the environment variables. After i copied all dll's form the MinGW/bin directory into the folder of the Hello World.exe the program worked smoothly. So it seems that whatever it is that needs those dll's cannot access them properly. I'd like to spare me the hassle of copying the dll's for every project i create. Is there any way i could work around that?
我对我的计算机和编程术语还不是很自信,所以描述可能有点粗略 - 仍然非常感谢帮助!
I'm not really confident about my computer and programming terminology yet so the description might seem a bit rough - help is still greatly appreciated!
干杯!
以下说明 为我完成了这项工作,因此我将它们添加到这里以供将来参考,因为这个问题需要相当长的时间.
The following instructions did the work for me so I add them here for future reference as this problem took quite some time.
先决条件
安装步骤
请注意,步骤 8 是解决问题的步骤.
Please note that step 8 is the one that solves the problem.
注意:您还应该将freeglut.dll
复制到您的.exe
所在的目录中.
Note: You should also copy freeglut.dll
in the directory where your .exe
is located.
这篇关于C++“Hello World.exe"崩溃 - “Hello World.exe 已停止工作."在命令提示符中使用时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!