SDL 'IMG_Load' & Setting Up Extension Libraries

This is a discussion on SDL 'IMG_Load' & Setting Up Extension Libraries within the Game Programming forums, part of the General Programming Boards category; Having just begun the Lazyfoo SDL tutorials, I am stuck on lesson 4. It is the first lesson in which ...

  1. #1
    Registered User
    Join Date
    Oct 2010
    Posts
    30

    SDL 'IMG_Load' & Setting Up Extension Libraries

    Having just begun the Lazyfoo SDL tutorials, I am stuck on lesson 4. It is the first lesson in which the user actually tests whether or not they configured their IDE and their executable to use the proper header files (and in my case dlls--I'm using Windows) in lesson 3, which addresses SDL extension libraries. I have successfully completed lessons 1 and 2.

    After having read through lessons 3 and 4 multiple times, I believe that I have all of the correct dlls and media sources in the correct directories, and I have configured my IDE (Codeblocks) and its linker options according to the guide. Yet, when I try to compile the code for lesson 4, I receive the "undefined reference to IMG_Load" error. This makes me think that something that should have been done in lesson 3 was not done. What does this error message suggest about my configuration of the SDL extension libraries addressed in lesson 3? Has anyone run into problems completing these lessons recently, (the binary downloads for SDL_image are of a different version than that listed in the lesson)?

    Relevant links for Windows + Codeblocks user:
    Lesson 3: Lazy Foo' Productions
    Lesson 4: Lazy Foo' Productions

  2. #2
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,438
    Did you manage to compile first without using the extension library? i.e. start with something simpler to test your actual main SDL libraries are linked correctly. You will be able to test by loading bitmpaps as they are supported natively without extension library.

    For some reason in the lazy foo stuff he advises adding the libraries as a flags in the global compiler settings,
    Personally i think you should ignore this and just set the path to your libraries in the project build options 'search directories tab' also use this to set the include path (which will probably just be mingw if you added the sdl header file folder in mingw/include)
    then also in the build options put the paths to the libraries to link to.
    Thought for the day:
    "Are you sure your sanity chip is fully screwed in sir?" (Kryten)
    FLTK: "The most fun you can have with your clothes on."

    Stroustrup:
    "If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"

  3. #3
    Registered User
    Join Date
    Oct 2010
    Posts
    30
    Yes, I already configured my main SDL libraries and tested that they worked properly in lessons 1 and 2. Also, I figured out my problem. Under "Global Compiler Settings" > "Linker Settings" tab > "Other Linker Options", I had a typo involving "Is" and "ls" ("eyes" and "ells"). It all works great now.

    The wrong string to put there (which I had the first time):
    -lmingw32 -lSDLmain -lSDL -ISDL_image

    The correct string to put there (which I have now):
    -lmingw32 -lSDLmain -lSDL -lSDL_image

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Undefined reference to.. probably Makefile problem
    By mravenca in forum C Programming
    Replies: 11
    Last Post: 10-20-2010, 04:29 AM
  2. Setting up SDL for C
    By 7h3_0r4c1_3 in forum C Programming
    Replies: 1
    Last Post: 08-25-2010, 10:30 AM
  3. Replies: 3
    Last Post: 11-07-2006, 05:41 AM
  4. Need help setting up SDL with MSVC
    By JOsephPataki in forum C Programming
    Replies: 4
    Last Post: 06-20-2003, 03:35 AM
  5. Which Libraries for SDL??
    By beginner in forum Game Programming
    Replies: 4
    Last Post: 02-19-2003, 06:35 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21