0

I am running into problems when linking SDL_image in gcc 3 on cygwin under Windows 7.

I receive the following error:

/usr/lib/gcc/i686-pc-cygwin/4.3.4/../../../../i686-pc-cygwin/bin/ld: cannot find -lSDL_image

My makefile appears as this:

all: rabbit

rabbit: main.o rabbit.o renderer.o
        g++ -o rabbit main.o rabbit.o renderer.o -lSDLmain -lSDL -lSDL_image 

main.o: main.cpp rabbit.h 
        g++ -c main.cpp 

rabbit.o: rabbit.cpp rabbit.h gameobject.h
        g++ -c rabbit.cpp

renderer.o: renderer.cpp renderer.h
        g++ -c renderer.cpp 

clean:
        rm -rf *o rabbit

I store SDL_image.dll, SDL_image.lib, jpeg.dll, libpng12-0.dll, libtiff-3.dll, and zlib1.dll in the directory with my executable. SDL_image.h is also in the correct location.

Please help, this has been at fault for a few days now!

Oisin
  • 9
  • 1
  • 2

1 Answers1

2

SDL_image is not part of the core SDL distribution. It must be installed separately.

Check if you have /usr/local/lib/libSDL_image.a or the shared library installed.

karlphillip
  • 92,053
  • 36
  • 243
  • 426
  • In that directory I have SDL_image.lib? – Oisin Apr 28 '11 at 01:38
  • Then you must add this library path to your compilation line: `g++ -o rabbit main.o rabbit.o renderer.o -L/usr/local/lib -lSDLmain -lSDL -lSDL_image`. If that doesn't work, try to pass it as `SDL_image.lib` or `-lSDL_image.lib` – karlphillip Apr 28 '11 at 01:42
  • 1
    Don't forget to accept my answer. There's a check box right next to the question. Click on it to select my answer as the official. – karlphillip Apr 28 '11 at 01:46