[英]SDL_image Out of Scope
我正在嘗試使用SDL入門。 SDL本身可以正常工作,我可以使用基本的Hello World設置。 但是,嘗試使用SDL_image引起了我很多頭痛。 我當前的代碼(如下)在第17行給我錯誤“此范圍內未聲明Img_Load”。
所需的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; }
任何和所有幫助將不勝感激!
當您遇到此類錯誤時,“ IMG_Load”會使用庫引用確認源文件中的大小寫。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.