Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Static linking with MinGW-64

Tags:

mingw-w64

I'm trying to use the 64-bit MinGW from http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Automated%20Builds/ but when I compile a program with it, the resulting executable fails when a DLL isn't available.

How do I get this compiler to do static linking with the standard library?

Or is there another distribution of 64-bit MinGW that I should be using instead?

like image 415
rwallace Avatar asked Oct 23 '22 11:10

rwallace


1 Answers

The g++ switch is supposed to be

    -static

See http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html.

    -static
        On systems that support dynamic linking, this prevents linking with
    the shared libraries. On other systems, this option has no effect.

You should post the command line, that you use in order to compile/link, in order to get more help if this does not work for you.

like image 105
David L. Avatar answered Oct 31 '22 11:10

David L.