Menu

undefined reference to winmain@16

tim tim
2008-01-17
2012-09-26
  • tim tim

    tim tim - 2008-01-17

    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.

     
    • cpns

      cpns - 2008-01-17

      Check the SDL headers. I seem to remember that there is some conditional compilation that affects the entry point implementation, you have to define the approproate macros to configure it. Do this by adding -D<macroname> compiler options to your project.

      I think the idea is that main() (or WinMain()) is defined by the framework and SDL applications start at SDL_main() which you define.

      All this from memory however!

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.