我开始学习 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 已停止工作."在命令提示符中使用时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
如何在 android eclipse 中制作水平滑动日历?How can I make a horizontal sliding calendar in android eclipse?(如何在 android eclipse 中制作水平滑动日历?)
Eclipse CDT 没有在头文件更改时构建项目Eclipse CDT not building project on header file change(Eclipse CDT 没有在头文件更改时构建项目)
Eclipse C++ 包括来自我的源文件夹的头文件Eclipse C++ including header file from my source folder(Eclipse C++ 包括来自我的源文件夹的头文件)
Eclipse C/C++ (CDT) 将文件导入项目 - 找不到头文件Eclipse C/C++ (CDT) import files into project - header file not found - include path(Eclipse C/C++ (CDT) 将文件导入项目 - 找不到头文件 - 包
如何在 Eclipse 中生成 JNI 头文件How to generate JNI header file in Eclipse(如何在 Eclipse 中生成 JNI 头文件)
Eclipse 中的编译器标志Compiler flags in Eclipse(Eclipse 中的编译器标志)