简体   繁体   中英

SDL_image Out of Scope

I'm trying to get off the ground with SDL. SDL by itself works fine, I got the basic Hello World setup to work. However, trying to use SDL_image has caused me a ton of headaches. My current code (below) gives me the error 'Img_Load' was not declared in this scope' at line 17.

  • My linker settings in Code::Blocks look like this: "-lmingw32 -lSDLmain -lSDL -lSDL_image"
  • Search directories are properly set up
  • The required DLLs are in the folder with the 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; } 

Any and all help would be greatly appreciated!

当您遇到此类错误时,“ IMG_Load”会使用库引用确认源文件中的大小写。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM