Fab Castel
Fab Castel

Reputation: 562

Problems with SDL image

I'm running on a mac OS 10.8.2 and compiling my program with the following command;

g++ main.cpp `sdl-config --cflags --libs` -o whateverfilename

I can compile SDL programs just fine but as soon as I try to use the SDL image library, things go wrong - I get the following errors:

Undefined symbols for architecture x86_64:
  "_IMG_Init", referenced from:
      _SDL_main in cco8lzYA.o
  "_IMG_Load_RW", referenced from:
      _SDL_main in cco8lzYA.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status

I'm guessing the linker is missing a search path or something. I've been trying to look up and edit the linker search paths but can't seem to manage even that so if someone could tell me how to do that or what other problems I might be causing I'd appreciate it :)

Upvotes: 3

Views: 965

Answers (1)

Daniel Figueroa
Daniel Figueroa

Reputation: 10666

I think you need to add the lSDL_Image compiler flag, I'm very much a noob when it comes to C++ and SDL, it was ages since I've done anything with it.

I also very much recommend LazyFoo's tutorials

Upvotes: 4

Related Questions