Installed MinGW g++ 4.5.2 and got the following Windows error when trying to run a C++ program I just compiled: The program can't start because libgcc_s_dw2-1.dll is missing from your computer.
After fixing that error, Windows displayed a similar message regarding libstdc++-6.dll
. Basically, g++ doesn not statically link the C and C++ standard libraries with an executable by default.
- In Windows, copy the required library files, libgcc_s_dw2-1.dll and libstdc++-6.dll from the MinGW bin folder into the same folder as the executable or add the MinGW bin folder into the PATH environment variable.
- If using NetBeans 6.9, configure the project properties to statically link the libraries to the executable:
- Select menu item File, Project Properties.
- In the Project Properties dialog, expand node Build, Linker.
- In Command Line, set Additional Options = -static-libgcc -static-libstdc++