List Info

Thread: Having some trouble statically linking libraries with MinGW




Having some trouble statically linking libraries with MinGW
country flaguser name
United States
2008-05-06 04:19:09
Hi everyone!

I am using MinGW/MSYS on a new system (while on my old one
I've been 
using Cygwin) and found that my new system doesn't
statically link 
libraries into my executable as I would like it to.

To exclude Eclipse as a possible failure source, I am
linking on the 
MSYS shell, and the command (using wxWidgets libraries)
   g++ -static -o"test.exe" test.o -L/mingw/lib
-lwx_base-2.8 
-lwx_msw_core-2.8
refused to link the executable for not finding the
libraries, however 
without the -static option it would compile just fine, then
(obviously) 
needing the DLL files upon execution of the compiled
program.

The actual library file names in /mingw/lib are
libwx_base-2.8.dll.a
libwx_msw_core-2.8.dll.a
so I altered the command to try and link with the
.dll-extension:
   g++ -static -o"test.exe" test.o -L/mingw/lib
-lwx_base-2.8.dll 
-lwx_msw_core-2.8.dll
Now this links "just fine" - as in: no complaints
from the linker, 
however, the resulting executable is exactly the same as if
I had never 
used the -static option to begin with: It will still require
the dll 
files for execution.

Can someone tell me what I am doing wrong? Do I maybe have
to compile my 
libraries differently so they can be statically linked?

Thank you in advance!

    Lars
_______________________________________________
help-gplusplus mailing list
help-gplusplusgnu.org

http://lists.gnu.org/mailman/listinfo/help-gplusplus

Re: Having some trouble statically linking libraries with MinGW
country flaguser name
United States
2008-05-06 08:40:02
case closed.

Solution:
I was missing the ./configure flag
"--disable-shared" - I'm not too 
familiar with configure scripts, but it seems to be
something not 
exclusive to wxWidgets (where I was experiencing the
problem) so I hope 
it might help others.

Best Regards,

    Lars
_______________________________________________
help-gplusplus mailing list
help-gplusplusgnu.org

http://lists.gnu.org/mailman/listinfo/help-gplusplus

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )