Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MinGW Link Single EXE

Tags:

c++

mingw

I installed MinGW and I just want to link my program into a single EXE file. I want to be able to give this EXE file to someone without having to worry about all the libgcc_s_dw2-1.dll, libstdc++-6.dll,or any other DLL. Is there a way to statically link all the required libraries into a single EXE?

I am developing on Windows 7.

like image 717
zam664 Avatar asked Feb 10 '12 03:02

zam664


1 Answers

You can use -static option when linking with libraries, and for libgcc and libstdc++ use the following:

-static-libgcc -static-libstdc++ 
like image 169
Jesse Good Avatar answered Oct 31 '22 16:10

Jesse Good