SDL图像问题

时间:2013-03-19 13:23:19

标签: c++ sdl

我在mac OS 10.8.2上运行并使用以下命令编译我的程序;

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

我可以很好地编译SDL程序但是一旦我尝试使用SDL图像库,就会出错 - 我收到以下错误:

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

我猜测链接器缺少搜索路径或其他东西。我一直在尝试查找和编辑链接器搜索路径,但似乎无法管理,所以如果有人可以告诉我如何做到这一点或我可能会导致什么其他问题我会很感激:)

1 个答案:

答案 0 :(得分:3)

我认为你需要添加lSDL_Image编译器标志,当谈到C ++和SDL时,我非常喜欢它,因为我已经做了很多事情。

我也非常推荐LazyFoo's tutorials