该程序无法启动,因为libgcc_s_dw2-1.dll缺失 [英] The program can't start because libgcc_s_dw2-1.dll is missing
问题描述
我在C ++中用Code :: Blocks创建了一个简单的程序。
如果我从Code :: Blocks运行它,但如果我通过双击可执行文件运行它,一个窗口弹出这个消息:
程序无法启动,因为libgcc_s_dw2计算机中缺少-1.dll。
尝试重新安装程序以解决此问题。
, 问题是什么?
我相信这是一个MinGW / gcc编译器问题,而不是微软Visual Studio设置。
libgcc_s_dw2-1.dll
应该在编译器的bin目录中。您可以将此目录添加到PATH环境变量以进行运行时链接,也可以通过向编译器标志中添加-static-libgcc -static-libstdc ++来避免此问题。
如果你计划分发可执行文件,后者可能是最有意义的。如果你只打算在你自己的机器上运行它,改变PATH环境变量是一个有吸引力的选项(保持可执行文件的大小)。
更新时间:
根据Greg Treleaven的反馈(见下面的评论),我添加了以下链接:
[Code :: Blocks项目构建选项的屏幕截图] p>
后面的讨论包括 -static-libgcc
和 -static-libstdc ++
链接器选项。
I have created a simple program in C++ with Code::Blocks.
If I run it from Code::Blocks, it works correctly; but if I run it by doubleclicking on the executable file, a window pops up with this message:
The program can't start because libgcc_s_dw2-1.dll is missing from your computer.
Try reinstalling the program to fix this problem.
So, what is the problem? What do I have to do to fix it?
I believe this is a MinGW/gcc compiler issue, rather than a Microsoft Visual Studio setup.
The libgcc_s_dw2-1.dll
should be in the compiler's bin directory. You can add this directory to your PATH environment variable for runtime linking, or you can avoid the problem by adding "-static-libgcc -static-libstdc++" to your compiler flags.
If you plan to distribute the executable, the latter probably makes the most sense. If you only plan to run it on your own machine, the changing the PATH environment variable is an attractive option (keeps down the size of the executable).
Updated:
Based on feedback from Greg Treleaven (see comments below), I'm adding links to:
[Screenshot of Code::Blocks "Project build options"]
The latter discussion includes -static-libgcc
and -static-libstdc++
linker options.
这篇关于该程序无法启动,因为libgcc_s_dw2-1.dll缺失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!