Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problems with SDL image

Tags:

c++

sdl

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 :)

like image 469
Fab Castel Avatar asked Feb 01 '26 05:02

Fab Castel


1 Answers

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

like image 126
Daniel Figueroa Avatar answered Feb 03 '26 17:02

Daniel Figueroa