[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Having some trouble statically linking libraries with MinGW
From: |
Lars Uffmann |
Subject: |
Having some trouble statically linking libraries with MinGW |
Date: |
Tue, 06 May 2008 11:19:09 +0200 |
User-agent: |
Thunderbird 2.0.0.14 (Windows/20080421) |
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
- Having some trouble statically linking libraries with MinGW,
Lars Uffmann <=