Reputation: 21
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.
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!
Upvotes: 1
Views: 871
Reputation: 1615
'IMG_Load' confirm case in your source file with the library reference when you reach errors like this.
Upvotes: 1