I've been reading the cone3d tutorials on SDL and tried to make a simple SDL program. I'm using Dev-C++ as my compiler. In the project options, I typed the following under extra libraries: -lmingw32 -lSDLmain -lSDL Here is the code:
#include <stdio.h>
#include <stdlib.h>
#include <SDL/SDL.h>
int main()
{
SDL_Surface *screen, *logo;
bool pause = true;
SDL_Rect dest;
if(SDL_Init(SDL_INIT_AUDIO | SDL_INIT_VIDEO) < 0)
exit(1);
atexit(SDL_Quit);
screen = SDL_SetVideoMode(640, 480, 32, SDL_HWSURFACE | SDL_DOUBLEBUF);
if(!screen)
exit(1);
logo = SDL_LoadBMP("intro.bmp");
dest.x = 0;
dest.y = 0;
SDL_BlitSurface(logo, NULL, screen, &dest);
SDL_Flip(screen);
while(pause)
{
SDL_Event event;
while(SDL_PollEvent(&event))
{
if(event.type == SDL_QUIT) pause = false;
if(event.type == SDL_KEYDOWN)
{
if (event.key.keysym.sym == SDLK_ESCAPE) pause = false;
}
}
}
return 0;
}
I get the following linker error when I compiled the code:
Quote: [Linker error] undefined reference to `SDL_main' |
What is causing this? Any help would be appreciated.