Can not compile with SDL_image

(FreeBSD implies sdl-config -> sdl11-config.)

I can not get my project to compile, once I rference IMG_Load() from
SDL_Image library:

0-23:02 dannyman at dell ~/Projects/isotiler> make
gcc -o isotiler sdl11-config --libs --cflags isotiler.c
/tmp/ccVC1R5V.o: In function main': /tmp/ccVC1R5V.o(.text+0x40f): undefined reference to IMG_Load’
*** Error code 1

Stop in /usr/home/dannyman/Projects/isotiler.
1-23:02 dannyman at dell ~/Projects/isotiler> cat Makefile
isotiler: isotiler.c
gcc -o isotiler sdl11-config --libs --cflags isotiler.c

Okay, so …

0-23:04 dannyman at dell ~/Projects/isotiler> grep -2 SDL_image.h isotiler.c
#include <stdlib.h>
#include “SDL.h”
#include “SDL_image.h”
#include “mysdllib.h”

0-23:04 dannyman at dell ~/Projects/isotiler> locate SDL_image.h
/u/local/include/SDL11/SDL_image.h
/u/ports/graphics/sdl_image/work/SDL_image-1.2.1/SDL_image.h
0-23:02 dannyman at dell ~/Projects/isotiler> sdl11-config --libs --cflags
-L/usr/local/lib -Wl,-rpath,/usr/local/lib -lSDL-1.1 -pthread -lm -L/usr/local/lib -lesd -laudiofile -lm -L/usr/X11R6/lib -lX11 -lXext -lXxf86vm -lXxf86dga -lXv -lXinerama -lvga -laa
-I/usr/local/include -I/usr/local/include/SDL11 -D_REENTRANT -D_THREAD_SAFE
0-23:06 dannyman at dell ~/Projects/isotiler> grep IMG_Load( /usr/local/include/SDL11/SDL_image.h
extern DECLSPEC SDL_Surface *IMG_Load(const char *file);

Near as I can tell, sdl11-config is giving me the path to SDL_image.h,
which contains the function I want … why am I getting this error? Is
there documentation somewhere on compiling programs with SDL and
SDL_Image? I’m good right until I try to start using the auxiliary
library …

Thanks,
-danny–

Hi,

I think you must also link to SDL_image. As far as I can see you are only linking to SDL but not SDL_image.

Try something like this:

make
gcc -o isotiler sdl11-config --libs --cflags -lSDL_image isotiler.c

Hope this helps.–
Alexander Bierbrauer

Coder & Coordinator of polyfrag
eMail: @Alexander_Bierbrauer
Web: http://www.polyfrag.com

~v^[running Linux Mandrake 8.1]^v~