The following program copied is not compiling in Anjutha with “/home/jayakumar/sdl-foobar/src/main.c:13: error: expected ?)? before ?filename?” message. The file name is main.c .Please help.
#include “SDL/SDL.h”
#include <string.h>
const int SCREEN_HEIGHT = 480;
const int SCREEN_WIDTH = 640;
const int SCREEN_BPP = 32;
SDL_Surface *message = NULL;
SDL_Surface *background = NULL;
SDL_Surface *screen = NULL;
SDL_Surface *loadimage(string filename){
SDL_Surface *loadedimage = NULL;
SDL_Surface *optimizedimage = NULL;
loadedimage = SDL_LoadBMP(filename.c_str());
optimizedimage = SDL_DisplayFormat(loadedimage);
SDL_FreeSurface(loadedimage);
return optimizedimage;
}
void applysurface(int x,int y,SDL_Surface *source,SDL_Surface *destination){
SDL_Rect offset;
offset.x=x;
offset.y=y;
SDL_BlitSurface(source,NULL,destination,&offset);
}
int main(int argc,char* args[]){
SDL_Init(SDL_INIT_EVERYTHING);
screen = SDL_SetVideoMode(SCREEN_HEIGHT,SCREEN_WIDTH,SCREEN_BPP,SDL_SWSURFACE);
message = SDL_LoadBMP(“hello.bmp”);
background = SDL_LoadBMP(“background.bmp”);
applysurface(0,0,background,screen);
applysurface(320,0,background,screen);
applysurface(0,240,background,screen);
applysurface(320,240,background,screen);
applysurface(160,140,message,screen);
DSL_FreeSurface(background);
DSL_FreeSurface(message);
SDL_Flip(screen);
SDL_Delay(2000);
SDL_Quit();
return 0;
}
Thanks in advance.