The program can't start because libgcc_s_dw2-1.dll is missing
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.
Can't run executable as libgcc_s_dw2-1.dll is missing
You should copy libgcc_s_dw2-1.dll
(it should be located somewhere similar to C:\MinGW\bin
or C:\Program Files\CodeBlocks\MinGW\bin
) into the same folder as the .exe
.
Program can't find libgcc_s_dw2-1.dll
The link commandline argument -static-libgcc
should work. Another variant you could try is plain -static
.
If you don't want to worry about this, and still want to redistribute your binary, just copy the relevant dll from MinGW's bin directory and place it alongside your executable. This is common practice and works as advertised.
Where Can I Get libgcc_s_dw2-1.dll?
That file implements the exception handling using DWARF information (new style, versus setjump/longjump or SJLj, the old style.
So you should need it only if your code depends on exceptions of any kind.
If you feel lucky you can grab my own compilation of this file from here.
How to fix error other computer the program can't start because libgcc_s_dw2-1.dll is missing from your computer on other computer
You have compiled and linked a computer program on your computer and distributed it to another. You need to include all the linked in dll's that don't come with Windows.
Find the required dll in your MinGW install and provide it to your friend and have him place it with your executable. There may be others. If MinGW has an ldd utility, you can use it to see what dll's your program links to.
Related Topics
Createprocess Doesn't Pass Command Line Arguments
How to Enable Experimental C++11 Concurrency Features in Mingw
Does C++ Contain the Entire C Language
C Function Pointers with C++11 Lambdas
Inverse Fourier Transformation in Opencv
Is There an Intra-Process Local Pipe in Qt
Member Access into Incomplete Type Error
How to Use the Priority Queue Stl for Objects
Calculate Rolling/Moving Average in C++
Reason for Using Non-Type Template Parameter Instead of Regular Parameter
Why Doesn't Delete Destroy Anything
Boost.Python Not Supporting Parallelism
Passing Variable Number of Arguments with Different Type - C++
Can't Modify Char* - Memory Access Violation
Calculating Convexitydefects Using Opencv 2.4 in C++
Is Msiopenproduct the Correct Way to Read Properties from an Installed Product