undefined reference to `WinMain' : When using Cygwin, SDL2 and Netbeans

前端 未结 2 1682
一生所求
一生所求 2021-01-22 05:32

any help here would be appreciated. Ive really racked my brains at this, sooo.

I have installed cygwin, and Netbeans and have been successfully deving, compiling and run

2条回答
  •  不要未来只要你来
    2021-01-22 06:03

    Have you tested with an #undef main infront of your main?

    /*
     * If 'main' is defined we clear that definition
     * to get our default 'main' function back.
     */
    #ifdef main
    # undef main
    #endif /* main */
    
    int main(int argc, char** argv)
    {
        // ...
        return 0;
    }
    

    Using Netbeans with Cygwin and SDL, including SDL.h creates strange error


    May also help:

    I get "Undefined reference to 'WinMain@16'"

    Under Visual C++, you need to link with SDL2main.lib. Under the gcc build environments including Dev-C++, you need to link with the output of "sdl-config --libs", which is usually: -lmingw32 -lSDL2main -lSDL2 -mwindows

    ( http://wiki.libsdl.org/FAQWindows#I_get_.22Undefined_reference_to_.27WinMain.4016.27.22 )

提交回复
热议问题