[英]C++ Program Won't Run From Windows Console
I'm learning C++ and I have completed a basic Hello World program.我正在学习 C++ 并且我已经完成了一个基本的 Hello World 程序。 The program runs fine in my IDE, but I am unable to run it from my Windows console.
该程序在我的 IDE 中运行良好,但我无法从我的 Windows 控制台运行它。
I am using the MinGW compiler.我正在使用 MinGW 编译器。
I have already added it to my path.我已经将它添加到我的路径中。
I am using Windows 10.我正在使用 Windows 10。
I am using the Eclipse IDE.我正在使用 Eclipse IDE。
When I try to run my program, I get the error that当我尝试运行我的程序时,我收到错误消息
The code execution cannot proceed because libgcc_s_dw2-1.dll was not found. Reinstalling the
program may fix this problem.
I double checked the bin folder in MinGW and it does have the libgcc_s_dw2-1.dll file.我仔细检查了 MinGW 中的 bin 文件夹,它确实有 libgcc_s_dw2-1.dll 文件。 And, as I said, MinGW is set to my path.
而且,正如我所说,MinGW 已设置为我的路径。
I know that there is a question like this already but those solutions did not help me.我知道已经有这样的问题,但这些解决方案对我没有帮助。 Any help would be much appreciated.
任何帮助将非常感激。 Thank you.
谢谢你。
EDIT: my compiler bin directory has been added to my path.编辑:我的编译器 bin 目录已添加到我的路径中。
I double checked the bin folder in MinGW and it does have the libgcc_s_dw2-1.dll file.
我仔细检查了 MinGW 中的 bin 文件夹,它确实有 libgcc_s_dw2-1.dll 文件。
Add your compiler bin
directory to PATH
.将您的编译器
bin
目录添加到PATH
。
OR copy this .dll
to the directory where your .exe
is.或将此
.dll
复制到.exe
所在的目录。 You'll have to do the same thing for libstdc++….dll
and probably also libwinpthreads….dll
.您必须为
libstdc++….dll
和可能还有libwinpthreads….dll
做同样的事情。
Note that if you decide to distribute your .exe
to other people, you'll have to distribute those .dll
s with it.请注意,如果您决定将
.exe
分发给其他人,则必须将这些.dll
与它一起分发。 In general, you can use ntldd
or a similar tool to figure out which .dll
s your program depends on.通常,您可以使用
ntldd
或类似工具来确定您的程序依赖于哪个.dll
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.