Original Post
I'm writing my first SDL program and I get the link error "undefined reference to 'WinMain@16'". Here is my code. Its a pretty simple "hello world" program. I'm using bloodshed's Dev-C++ IDE I put "libSDL", "libSDLmain", and "libgdi32" in my linker. I know I have gottedn this "WinMain@16" error before and thought I had fixed it by linking "libgdi32" but it doesn't fix the error this time. Any help would be really appreciated so I can get into SDL.
#include <SDL/SDL.h>
int main(int argc, char* argv[]){
//initialize SDL and the video subsystem
if(SDL_Init( SDL_INIT_VIDEO ) < 0)
return -1;
//signal SDL to change the text of the main window to "SDL Hello World"
SDL_WM_SetCaption("Hello World", "Hello World");
//create an SDL_Surface object which represents the game window
SDL_Surface* screen = SDL_SetVideoMode(640, 480, 0, 0);
SDL_Surface* temp = SDL_LoadBMP("hello.bmp");
SDL_Surface* bg = SDL_DisplayFormat(temp);
SDL_FreeSurface(temp);
SDL_Event event;
bool quit = false;
while(!quit)
{
if( SDL_PollEvent(&event))
{
switch (event.type)
{
case SDL_QUIT:
quit = true;
break;
case SDL_KEYDOWN:
switch(event.key.keysym.sym)
{
case SDLK_ESCAPE:
quit = true;
break;
}
break;
}
}
SDL_BlitSurface(bg, NULL, screen, NULL);
SDL_UpdateRect(screen, 0, 0, 0, 0);
}
SDL_FreeSurface(bg);
SDL_Quit();
return 0;
}