[Iup-users] Library linking issues on Windows (MinGW)
Brought to you by:
scuri
|
From: Tiago R. <wt...@gm...> - 2011-06-14 18:10:32
|
Hello all,
I've dowloaded IUP 3.5 for MinGW (package iup-3.5_Win32_mingw4_lib) and set
it up in an MSys environment using gcc 4.5.2. I then tried to compile the
sample.c file present in the documentation, but got some really strange
linking errors between the binary library libiup.a and its Win32
dependencies. I'm not sure it's actually the library's fault at all, but
I'd like to post it here anyway to see if maybe someone can catch something
I'm missing...
The compilation line is:
$ gcc -o sample.exe sample.c -I/usr/local/include/iup -L/usr/local/lib
-lgdi32 -luser32 -lcomdlg32 -lcomctl32 -lole32 -liup
It returns a couple of hundred linking errors, one of which is:
/usr/local/lib/libiup.a(iupwin_tree.o):iupwin_tree.c:(.text+0x3c19):
undefined reference to `SetBkColor@8'
The other report other decorated symbols relating to Win32 API system
calls. This particular call, SetBkColor(), is in libgdi32.a. nm reports:
$ nm /mingw/lib/libgdi32.a | grep "SetBkColor@8"
00000000 T _SetBkColor@8
00000000 I __imp__SetBkColor@8
The symbol defined in the GDI library has a leading underscore, which is why
gcc can't seem to find it. That is strange, though, because since this
version of the library is compiled for MinGW, it should have the leading
underscore in its symbol, as befits the __cdecl decorated names in Windows.
And, in fact, nm says of libiup.a:
$ nm /usr/local/lib/libiup.a | grep "SetBkColor@8"
U _SetBkColor@8
U _SetBkColor@8
U _SetBkColor@8
U _SetBkColor@8
So, all undefined references actually DO have the underscore prepended.
What gives, then? How is the compilation failing? Why is it reporting that
it cannot find `SetBkColor@8' when it should be looking for `_SetBkColor@8'?
Is there a flag I'm supposed to set which I'm missing? Is the linking order
for the libraries wrong? Obviously everyone else seems to be able to
compile just fine; I can't really think of anything else to try, though, and
maybe my mistake will be really obvious to someone.
Kind regards,
-Tiago Rodrigues
--
In those days, in those distant days, in those nights, in those remote
nights, in those years, in those distant years...
- Gilgamesh, Enkidu and the Underworld
|