The program can#39;t start because libgcc_s_dw2-1.dll is missing(程序无法启动,因为缺少 libgcc_s_dw2-1.dll)
问题描述
我用 Code::Blocks 用 C++ 创建了一个简单的程序.
如果我从 Code::Blocks 运行它,它可以正常工作;但是如果我通过双击可执行文件来运行它,则会弹出一个带有此消息的窗口:
<块引用>程序无法启动,因为您的计算机缺少 libgcc_s_dw2-1.dll.
尝试重新安装程序以解决此问题.
那么,问题是什么?我该怎么做才能修复它?
我认为这是 MinGW/gcc 编译器问题,而不是 Microsoft Visual Studio 设置.
libgcc_s_dw2-1.dll
应该在编译器的 bin 目录中.您可以将此目录添加到您的 PATH 环境变量以进行运行时链接,或者您可以通过在编译器标志中添加-static-libgcc -static-libstdc++"来避免该问题.
如果您打算分发可执行文件,则后者可能最有意义.如果您只打算在自己的机器上运行它,那么更改 PATH 环境变量是一个有吸引力的选择(减少可执行文件的大小).
更新:
根据 Greg Treleaven 的反馈(见下面的评论),我添加了以下链接:
[Code::Blocks项目构建选项"的屏幕截图]
[GNU gcc 链接选项]>
后面的讨论包括 -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"]
[GNU gcc link options]
The latter discussion includes -static-libgcc
and -static-libstdc++
linker options.
这篇关于程序无法启动,因为缺少 libgcc_s_dw2-1.dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:程序无法启动,因为缺少 libgcc_s_dw2-1.dll


基础教程推荐
- 常量变量在标题中不起作用 2021-01-01
- 如何将 std::pair 的排序 std::list 转换为 std::map 2022-01-01
- 如何在 C++ 中初始化静态常量成员? 2022-01-01
- 在 C++ 中计算滚动/移动平均值 2021-01-01
- 我有静态或动态 boost 库吗? 2021-01-01
- C++结构和函数声明。为什么它不能编译? 2022-11-07
- 如何通过C程序打开命令提示符Cmd 2022-12-09
- 这个宏可以转换成函数吗? 2022-01-01
- 如何检查GTK+3.0中的小部件类型? 2022-11-30
- 静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么? 2021-01-01