在函数"int __cdecl invoke_main(void)"中引用的错误LNK2019无法解析的外部符号_WinMain @ 16;(?invoke_main @@ YAHXZ) [英] Error LNK2019 unresolved external symbol _WinMain@16 referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)

查看:816
本文介绍了在函数"int __cdecl invoke_main(void)"中引用的错误LNK2019无法解析的外部符号_WinMain @ 16;(?invoke_main @@ YAHXZ)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的剧本我不知道解决这个错误请帮我非常感谢

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 

void display()
{

    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); // clear screen and depth buffer
    glLoadIdentity();

    glPushMatrix();

    glColor3f(1.0, 0.0, 0.0);

    glBegin(GL_POLYGON);


    glVertex2f(160.0, 360.0);
    glVertex2f(300.0, 360.0);
    glVertex2f(160.0, 480.0);
    glVertex2f(300.0, 480.0);

    glPushMatrix();

    glColor3f(0.0, 0.0, 0.0);
    glVertex2f(580.0, 200.0);
    glVertex2f(640.0, 200.0);
    glVertex2f(580.0, 480.0);
    glVertex2f(640.0, 480.0);

    glRotatef(angle, -1.0f, 0.0, 0.0);

    angle += 15.0f;






    glEnd();




    glutSwapBuffers(); // dounle buffering

}
LRESULT CALLBACK MainWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch (uMsg)
    {
    case WM_LBUTTONDOWN:
    {



    }break;

    case WM_DESTROY: {


        PostQuitMessage(0);

    }break;


    default:break;
    }
    return 0;
}



int main(int argc, char** argv)
{
    glutInit(&argc, argv); // Initialize GLUT

    glutInitDisplayMode(GLUT_DOUBLE);// Set up some memory buffers for our display


    glutInitWindowSize(640, 400);
    glutInitWindowPosition(100, 20);
    glutCreateWindow("My GLUT GAME");
    glutDisplayFunc(display);
    //glutKeyboardFunc();


    glutMainLoop();
    return 0;
}

推荐答案

您已将项目设置为作为Windows应用程序而不是命令行应用程序进行构建.将 int main()更改为:

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

int回调WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR pCmdLine,int nCmdShow)

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

或者,将您的项目属性更改为命令行应用程序.

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

这篇关于在函数"int __cdecl invoke_main(void)"中引用的错误LNK2019无法解析的外部符号_WinMain @ 16;(?invoke_main @@ YAHXZ)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆