sdl@lists.libsdl.org
[Top] [All Lists]

[SDL] Undefined reference to SDL_main

Subject: [SDL] Undefined reference to SDL_main
From: Tim Rau
Date: Thu, 17 Jan 2008 07:40:07 +0000 UTC
I've been getting this error while trying to compile an SDL appilication.
I do not think it is an SDL error, as I have read and followed two SDL 
tutorials to the letter. I have already done as much googling as I can 
(an hour and a half), read all the faqs, and searched the forums and my
searches reveal nothing. I have set my Linker options to 

-lmingw32 -lSDLmain -lSDL

without the -lmingw32, it gives "undefined reference to winmain@16" With 
it, it gives "undefined reference to SDL_main"  It seems to me that I am
linking against a library with that very name. If you can help me, I'd 
much appreciate it.

Here is my(very short) code:

#include <iostream>
#include <SDL\SDL.h>
using namespace std;


int main()
{
/*    if (SDL_Init(SDL_INIT_VIDEO) != 0)
    {
        cout<<"SDL: "<<SDL_GetError()<<endl;
        exit(-1);
    }
    atexit(SDL_Quit);
  */  
    system("PAUSE");
    return 0;
}
 

You can see that at this point I've cut out everything: I'm just trying to link
against SDL at this point.

Please help me.

_______________________________________________
SDL mailing list
SDL@xxxxxxxxxxxxxxxx
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

<Prev in Thread] Current Thread [Next in Thread>