RWops enemy_rwops = new RWops.from_file("img/enemy.png", "rb");
enemy = SDLImage.load_png(enemy_rwops);
我有加载.png的代码(敌人是SDL_Surface)。但是,我收到了这个错误:
/tmp/ccGDtjkw.o: In function `':
main.vala.c:(.text+0x59): undefined reference to `IMG_LoadPNG_RW'
collect2: error: ld returned 1 exit status
error: cc exited with status 256
Compilation failed: 1 error(s), 0 warning(s)
这两行是在我的构造函数中,我确实是“使用SDLImage”并将其添加到“--pkg”编译行中:
valac --pkg sdl --pkg sdl-gfx --pkg sdl-image -X -lSDL_gfx -o mission- main.vala
有什么想法吗?
答案 0 :(得分:0)
valac --pkg sdl --pkg sdl-gfx --pkg sdl-image -X -lSDL_gfx -X -lSDL_image --Xcc=-I/usr/include/SDL -o game main.vala
知道了,只需使用该编译行。