# Linkage problems with SDL_gfx and Dev-cpp

## Recommended Posts

Warlax    122
Hi, I have some problems with compiling a project with SDL_Gfx's rotozoom. I have included: #include "SDL_rotozoom.h" (added after I have the SDL.h includes) My project (before SDL_gfx) is working perfectly with SDL_ttf.h and SDL_image.h In my project options' parameters I have this: -ISDL_gfx -lSDL_image -lSDL_ttf -lmingw32 -lSDLmain -lSDL *** At first the compiler was giving me two invalid errors where rotozoom.h was assigning a void* to some user-defined class pointer... but I solved them using simple casting. This is the message the compiler gives me: "...\SDL_rotozoom.c [Warning] 'void zoomSurfaceSize(int, int, double, double, int*, int*)' defined locally after being referenced with dllimport linkage" [Linker error] undefined reference to _imp__rotozoomSurfaceXY' [Linker error] undefined reference to _imp__zoomSurfaceSize' . . . C:\Dev-Cpp\progs\Renaissance\Makefile.win [Build Error] [Renaissance.exe] Error 1 === I have SDL_gfx.dll in the same folder as my executable. I have all the .h and .c files copied into both my project's folder and the dev-cpp\include folder... === please help me!!!

##### Share on other sites
Your linker parameters has a capital i in -ISDL_gfx as opposed to a lowercase L.

Does that help any? If not, you need to add the .o or .a file before your current linker parameters. (It would be called libSDL_gfx.a or something simular).

##### Share on other sites
Warlax    122
Ok, thank you.
I changed all my capital I's to lowercase l.
Now the problem the compiler is telling me about has changed slightly...

840 C:\Dev-Cpp\progs\Renaissance\SDL_rotozoom.c [Warning] 'void zoomSurfaceSize(int, int, double, double, int*, int*)' defined locally after being referenced with dllimport linkage

840 C:\Dev-Cpp\progs\Renaissance\SDL_rotozoom.c multiple definition of rotozoomSurfaceXY'

840 C:\Dev-Cpp\progs\Renaissance\SDL_rotozoom.c first defined here

840 C:\Dev-Cpp\progs\Renaissance\SDL_rotozoom.c multiple definition of zoomSurfaceSize'

840 C:\Dev-Cpp\progs\Renaissance\SDL_rotozoom.c first defined here

==================================
*** it does not matter if I add libSDL_gfx.a before the paramater list or not, it still does this.

my parameter list:

../../lib/libSDL_gfx.a
-lSDL_gfx -lSDL_image -lSDL_ttf -lmingw32 -lSDLmain -lSDL

What is the problem now???

##### Share on other sites
Do you happen to have a libSDL_gfx.dll.a by any chance? I can get it to work by this set of parameters:

../../../../Dev-Cpp/lib/libSDL_gfx.dll.a
-lSDL_input -lSDL_gfx
-lmingw32 -lSDLmain -lSDL

(Ignore -lSDL_input, as that is unrelated to SDL_gfx)
It doesn't seem to accept libSDL_gfx.a, but accepts libSDL_gfx.dll.a

This compiles, anyhow. When running my test program, I get the 'SDL Parachute Deployed' message. Perhaps my build of the DLL is faulty, however, and you'd have better runs in that regard. (I could have quite easily botched my compilation of the SDL_gfx DLL)

Sorry I can't be of further help.

##### Share on other sites
sphen_lee    199
It appears that you are linking SDL_Gfx, and compiling it in at the same time. Thats why it says u have defined those functions twice.

Either you can remove SDL_Gfx from the linker options, or remove SDL_rotozoom.c from your project (I suggest the second option as this is the way most libraries are designed to work)