Error LNK2019 unresolved external symbol _WinMain@16 referenced in function “int __cdecl invoke_main(void)” (?invoke_main@@YAHXZ)

后端 未结 4 812
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-14 07:30

This is my script i have no idea to solve this error Please help me Thank you so much

float angle = 15;
float x, y, z;               // for polygon rotate 

voi         


        
相关标签:
4条回答
  • 2021-02-14 07:57

    As workaround you can add WinMain function from which call main:

    #ifdef _WIN32
    int APIENTRY WinMain(HINSTANCE hInstance,
        HINSTANCE hPrevInstance,
        LPSTR lpCmdLine, int nCmdShow)
    {
        return main(__argc, __argv);
    }
    #endif
    
    0 讨论(0)
  • 2021-02-14 08:12

    For me following this helped.

    Go to properties->Linker -> System -> Sub-system and choose "not set" or "Windows"

    0 讨论(0)
  • 2021-02-14 08:15

    I had to make the application as executable project with output type .exe Key change was changing Linker -> System -> Sub-system to Console

    0 讨论(0)
  • 2021-02-14 08:20

    You've set the project to build as a Windows application, not a command line application. Change int main() to:

    int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCmdLine, int nCmdShow)

    https://msdn.microsoft.com/en-us/library/windows/desktop/ms633559%28v=vs.85%29.aspx

    Or, change your project properties to be a command line application.

    0 讨论(0)
提交回复
热议问题