[SDL] Cannot compile with MinGW under Debian Etch

tknits kitsahcots tknits.kitsahcots at googlemail.com
Thu Feb 15 14:57:19 PST 2007


Hello.

I followed the Instructions in
http://wiki.njh.eu/MinGW-Cross-Compiling_mit_SDL (this is in german
unfortunately) to install MinGW and SDL for Windows under Debian Etch.

Now trying to compile my own little program (it is not very big) for
Linux works fine. For windows, using MinGW, as long as i do not use
SDL, or link, everything seems to be fine.

I can compile the Files "Image.o" and "SdlEnvironment.o" and
"Kollisionen.o" (which are needen first) without any Problems. Such,
the last thing I need to do is:

$i586-mingw32msvc-g++ -o KollisionenTest KollisionenTest.cpp
`/usr/i586-mingw32msvc/bin/sdl-config --cflags`
`/usr/i586-mingw32msvc/bin/sdl-config --libs` Kollisionen.o Image.o
SdlEnvironment.o

But there I get the Error-Messages

Image.o:Image.cpp:(.text+0x32): undefined reference to `_SDL_RWFromFile'
Image.o:Image.cpp:(.text+0x3b): undefined reference to `_SDL_LoadBMP_RW'
Image.o:Image.cpp:(.text+0x126): undefined reference to `_SDL_MapRGB'
Image.o:Image.cpp:(.text+0x139): undefined reference to `_SDL_SetColorKey'
Image.o:Image.cpp:(.text+0x178): undefined reference to `_SDL_RWFromFile'
Image.o:Image.cpp:(.text+0x181): undefined reference to `_SDL_LoadBMP_RW'
Image.o:Image.cpp:(.text+0x26c): undefined reference to `_SDL_MapRGB'
Image.o:Image.cpp:(.text+0x27f): undefined reference to `_SDL_SetColorKey'
Image.o:Image.cpp:(.text+0x29b): undefined reference to `_SDL_FreeSurface'
Image.o:Image.cpp:(.text+0x2c5): undefined reference to `_SDL_FreeSurface'
SdlEnvironment.o:SdlEnvironment.cpp:(.text+0x84): undefined reference
to `_SDL_SetVideoMode'
SdlEnvironment.o:SdlEnvironment.cpp:(.text+0x11e): undefined reference
to `_SDL_SetVideoMode'
SdlEnvironment.o:SdlEnvironment.cpp:(.text+0x143): undefined reference
to `_SDL_FreeSurface'
SdlEnvironment.o:SdlEnvironment.cpp:(.text+0x167): undefined reference
to `_SDL_FreeSurface'
SdlEnvironment.o:SdlEnvironment.cpp:(.text+0x1a5): undefined reference
to `_SDL_UpperBlit'
SdlEnvironment.o:SdlEnvironment.cpp:(.text+0x1bd): undefined reference
to `_SDL_Flip'
SdlEnvironment.o:SdlEnvironment.cpp:(.text+0x1d3): undefined reference
to `_SDL_Delay'
collect2: ld returned 1 exit status
make: *** [main] Fehler 1

Seems like it cannot find the Libraries. But:

$ echo `/usr/i586-mingw32msvc/bin/sdl-config --cflags`
-I/usr/i586-mingw32msvc/include/SDL -Dmain=SDL_main

$ echo `/usr/i586-mingw32msvc/bin/sdl-config --libs`
-L/usr/i586-mingw32msvc/lib -lmingw32 -lSDLmain -lSDL -mwindows

This should be correct. I also tried --static-libs instead... Same
error... And also

$ echo `/usr/i586-mingw32msvc/bin/sdl-config --static-libs`
-L/usr/i586-mingw32msvc/lib -lmingw32 -lSDLmain -lSDL -mwindows
-luser32 -lgdi32 -lwinmm -ldxguid

I think this should also be correct... I looked it up, there are the files

$ ls /usr/i586-mingw32msvc/lib/libSDL.*
/usr/i586-mingw32msvc/lib/libSDL.a
/usr/i586-mingw32msvc/lib/libSDL.dll.a
/usr/i586-mingw32msvc/lib/libSDL.la

So what can be wrong? This should work, but it doesnt.


More information about the SDL mailing list