Archived

This topic is now archived and is closed to further replies.

Tszafran

Newbie SDL Question

Recommended Posts

Tszafran    122
Hello, I have the SDL installed correctly and can compile Cone3D tutorials, but when I tried my own creation I get errors and have no clue why. Source Code below... #include #include #include SDL_Surface *Screen; SDL_Surface *Grass; int XPos=0,YPos=0; //------------------------------------------------- void InitImages(void) { Grass=SDL_LoadBMP("grass.bmp"); } //------------------------------------------------- void DrawImage(SDL_Surface *Image, int X, int Y) { SDL_Rect Dest; Dest.x=X; Dest.y=Y; SDL_BlitSurface(Image, NULL, Screen, &Dest); } //------------------------------------------------- void main(void) { if (SDL_Init(SDL_INIT_AUDIO|SDL_INIT_VIDEO)<0) { printf("Unable to initialize SDL: %s\n", SDL_GetError()); exit(1); } atexit(SDL_Quit); Screen=SDL_SetVideoMode(800,600,32,SDL_HWSURFACE|SDL_DOUBLEBUF); if(Screen==NULL) { printf("Unable to set to 800x600 video: %s\n", SDL_GetError()); exit(1); } InitImages(); int Done=0; while(Done==0) { SDL_Event Event; while(SDL_PollEvent(&Event)) { if(Event.type==SDL_QUIT) {Done=1;} } DrawImage(Grass,5,5); SDL_Flip(Screen); } } MSVC++ --------------------Configuration: lesson2 - Win32 Debug-------------------- Compiling... lesson2.cpp Linking... SDLmain.lib(SDL_main.obj) : error LNK2001: unresolved external symbol _SDL_main Debug/lesson2.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe. lesson2.exe - 2 error(s), 0 warning(s) Im 100% precent sure I am linking the libraries, etc.. Can anyone give me some helpful ideas?

Share this post


Link to post
Share on other sites
Martee    476
Now I''m no SDL expert, but it seems like SDL is looking for an entry point called SDL_main(), while you are only using main().

Share this post


Link to post
Share on other sites