SDL: Undefined reference to IMG_LOAD [Solved]

By nick | Code
30 Nov 2011

If you’re trying to get SDL_Image to work correctly and are getting the following error:

undefined reference to `IMG_Load`

Here’s how to fix it:

Go to your compiler link options, in code and add

-lSDL_image

Codeblocks Linker Options for SDL

 

11 Comments

  1. zach says:

    it doesnot work i have tried

  2. John says:

    Still don’t work! What shod i do?

  3. abdeljabar says:

    OK it worked very well, but you’re pointing to another file which I couldn’t find “-lSDL_image” or “lSDL_image”

    I could only find SDL_image under the lib directory

    anyway thank you!

  4. Symbol says:

    Solution: If you are using a 64bit computer, make sure to use the SDL_Image files from the >x86 folder< NOT THE X64!

  5. tbillion says:

    thank you worked great however codeblocks doesnt need the -l option it adds it auto matically

Leave a Reply