Linking Sdl_gfx Using Mingw


Ksmiler

Member
Joined
Apr 30, 2003
Messages
123
Location
Yamaguchi, Japan
Hello, Im trying to compile my SDL program for Windows using MinGW. The program compiles using DevKitGP2X but not when using MinGW.

I get the following error:
CODE
Linking tutorial.exe...
_objs/_win32/sdltest.o(.text+0x2c8):sdltest.cpp: undefined reference to `_imp__rotozoomSurface'
collect2: ld returned 1 exit status
make[1]: *** [tutorial.exe] Error 1
make: *** [win32] Error 2



The libraries I have in my makefile is...
CODE
LIBS = -lmingw32 -lSDLmain -lSDL -lSDL_image -lSDL_gfx -lSDL_mixer -lSDL_ttf



I have tried rearranging the order of the defined libraries, but still no luck.. Am I missing something critical? :blink:

If the problem is still not clear ill explain more :)
Thanks!
 
Ksmiler said:
The libraries I have in my makefile is...
CODE

Code:
LIBS =  -lmingw32 -lSDLmain -lSDL -lSDL_image -lSDL_gfx -lSDL_mixer -lSDL_ttf [/quote]
I have tried rearranging the order of the defined libraries, but still no luck.. Am I missing something critical?  :blink: 



Pretty sure they should be arranged more or less in the opposite order..

-lpthread -lSDL_gfx -lSDL_image -lSDL_mixer -lSDL_ttf -lSDLmain -lSDL
 
Last edited by a moderator:
CODE
LIBS = -lmingw32 -lSDL_gfx -lSDL_image -lSDL_mixer -lSDL_ttf -lSDLmain -lSDL


Still no luck, I get the same error message :(
 
Ksmiler said:
CODE
LIBS = -lmingw32 -lSDL_gfx -lSDL_image -lSDL_mixer -lSDL_ttf -lSDLmain -lSDL
Still no luck, I get the same error message :(


Then I suggest using the pre-compiled code-blocks package. It has the correct libraries usage in the project template.. I'd copy and paste it, but my windows dev environment is gone after a drive crash and all I use is linux these days. I do remember having to fight a long time to get the proper order of linking. Seems to be even more difficult under windows but I got it eventually.

http://archive.gp2x.de/cgi-bin/cfiles.cgi?0,0,0,0,14,2295

It'd be nice to see the actual command line being passed to GCC. All we see here is the pretty output from some build script or IDE.
 
Last edited by a moderator:
Hey Senor Quack, thanks for your quick replies!

I have tried using the yaustar's MinGW setup (good job with that btw!) with CodeBlocks + the demo SDLTest project and tried to make a Win32 app of the SDL Test project. And it said that SDL_gfx was not installed (like in the past of my MinGW setup).

To fix missing library problem (in my MinGW setup), I used MSYS to compile the SDL_gfx source, then copied the binaries into my MinGW include and lib directories. I added the SDL_gfx library into the list of libraries to use when linking, and the error was generated.

I have just copied the binaries to yaustar's MinGW and also added the -lSDL_gfx to the linker options for the Win32 build (corrected the default parameter which was -lSDLgfx) and rebuilt the project.

The error it generated was:
CODE
undefined reference to `_imp__rotozoomSurfaceXY'


..which is basically the same problem I am currently having with my project + setup compiling. :(

I have included the project which cant compile at http://www.ksmiler.pwp.blueyonder.co.uk/SDLTutorial.zip.
Just type "make win32" as the command to compile it.
 
Try downloading the codeblocks package that comes with devkit2x and extracting it into a temporary directory. Copy the libSDL_gfx.a out of it into your library directory. If that doesn't work, I'd try moving entirely to the codeblocks package (it comes with devkit2x and you don't necessarily need to use codeblocks if you don't like it. it's an optional part of the overall package, what is important is it sets up a good optimized set of libraries and a toolchain that is known to work properly.

I am wondering if for some reason the SDL_gfx you compiled ended up being compiled without the rotozoomer. I'm still not sure though if SDL_gfx is being properly linked in in the first place.
 
In Code::Blocks, there should be a setting to give verbose output (ie the commandline to GCC).
 
Senor Quack said:
I am wondering if for some reason the SDL_gfx you compiled ended up being compiled without the rotozoomer. I'm still not sure though if SDL_gfx is being properly linked in in the first place.
Haha it seems that was exactly the problem!
I compiled it using just "./configure && make && make install"... which is wrong :p

I used this tutorial at Wormux.org and did it the proper way..
It is now working woo!

Lesson learned is don't cut corners when you are sleepy... You will stay awake longer fixing the problems the shortcut caused. :(

Thanks very much for all your help Senor Quack and yaustar! ;)
/sleeps
 
Last edited by a moderator:
Back
Top