Author Topic: [solved] SDL and Code Blocks (IMG_Load)  (Read 5190 times)

Offline ravenshade

  • Multiple posting newcomer
  • *
  • Posts: 12
[solved] SDL and Code Blocks (IMG_Load)
« on: August 08, 2011, 02:18:15 pm »
The title basically says what my issue is and I have searched and I have tried different methods of solving the problem, however...no luck.

I am using Ubuntu 10.10 (Maverick) ...Kernal 2.6.35-30-Generic for the techies.

I am using the Code::Blocks supplied with the repository. 10.05

Yesterday (yes this is an odd problem) using LazyFoo's tutorial, I compiled a program using SDL/SDL_image.h, specifically the BMP loader and that works fine (I believe it still does).

Unfortunately, when I try to use IMG_Load, it comes back with an undefined reference. (I have copied and pasted his tutorial line for line). I'm not entirely sure what I've done wrong, or what is happening but it (Code::Blocks or the compiler) doesn't seem to be recognising SDL_image.h in the slightest.

I've tried adding things to the Other Options under compiler settings and no joy, I have also tried adding items under the linker settings in other linker options. Again, nothing seemed to make a difference.

I made sure to reinstall the relevant library. Here is the the tutorial I have used: http://lazyfoo.net/SDL_tutorials/lesson04/index.php

Could someone explain what I'm doing wrong or what I need to change as I thought Code::Blocks would recognise the library files on its own.
« Last Edit: August 08, 2011, 08:46:06 pm by ravenshade »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: SDL and Code Blocks (IMG_Load)
« Reply #1 on: August 08, 2011, 02:36:36 pm »
Read this: http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F

Also keep in mind that C::B won't do anything you've not told it to do.
If you've not setup a library to be linked it won't be linked auto-magically.
C::B is for people who know what to do and know how compiling and linking work, and know how to setup a project.

This seems like the correct tutorial: http://lazyfoo.net/SDL_tutorials/lesson03/linux/cli/index.php

But If I were you I'd rather search for a tutorial on linking/libraries/shared objects...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ravenshade

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: SDL and Code Blocks (IMG_Load)
« Reply #2 on: August 08, 2011, 02:44:49 pm »
That lesson compiled fine until today. It's the next lesson that's causing the issues.

This one will have to be put on hold until I can figure why the hell the previous lesson chooses not to compile anymore.


But If I were you I'd rather search for a tutorial on linking/libraries/shared objects...

Linking items I can do, I'm just wondering why it works one day and not the next.

turns out they'd disappeared from the library. I'm debugging that but I think it's an ubuntu issue >.>;
« Last Edit: August 08, 2011, 03:13:12 pm by ravenshade »