我正试图用SDL开始。 SDL本身工作正常,我得到了基本的Hello World设置。但是,尝试使用SDL_image让我感到很头疼。我当前的代码(下面)给出了错误'Img_Load'未在第17行的此范围内声明。
所需的DLL位于带有EXE的文件夹中。
include iostream
include fstream
include "SDL/SDL.h"
include "SDL_image.h"
using namespace std;
const int SCREEN_WIDTH = 600;
const int SCREEN_HEIGHT = 600;
int main(int argc, char *argv[]){
SDL_Init(SDL_INIT_EVERYTHING);
SDL_Surface* hello = NULL;
SDL_Surface* screen = NULL;
screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 32, SDL_SWSURFACE);
hello = Img_Load("img\\hello world.png");
if(!hello) //check that the load worked
cout<<"error";
SDL_BlitSurface(hello, NULL, screen, NULL); //draw image
SDL_Flip(screen);
SDL_Delay(2000);
SDL_FreeSurface(hello); //closing down
SDL_Quit();
return 0;
}
非常感谢任何和所有帮助!
答案 0 :(得分:1)
'IMG_Load'会在您的源文件中使用库引用确认大小写。