Advertisement

Newbie SDL Question

Started by December 18, 2001 02:21 PM
1 comment, last by Tszafran 23 years ago
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?
MSN Messenger: Thomas_Szafran@hotmail.com
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().
ReactOS - an Open-source operating system compatible with Windows NT apps and drivers
Advertisement
Your an expert in my books, it seems i cannot have my main as

void main();

but rather

int main(int argc, char *argv[])

Thanks alot.
MSN Messenger: Thomas_Szafran@hotmail.com

This topic is closed to new replies.

Advertisement