OpenGL ES Tutorial - 'Winmain': function c

2019-01-26 17:40发布

问题:

I'm trying to learn OpenGL ES with the "OpenGL ES Training Course" (An OpenGL ES tutorial). I use OPENGL-ES 1.1 WINDOWS PC EMULATION with visual studio 2010. I'm trying to compile the 'hello triangle' program and get an error:

'WinMain': function cannot be overloaded

EDIT: I have only one definition of WinMain in the project: The one in the 'hello triangle' source code (which I didn't write).

Could anyone tell me what's going on?

回答1:

It sounds like you have two definitions of WinMain, or perhaps a prototype and a definition that disagree.



回答2:

I had the problem too. It showed that I have overloaded the function: My old text:

#include "windows.h"

int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, long lpCmdLine, int nCmdShow)

{

}

and my new text:

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

With the new text it works



回答3:

Try

int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){

    // Your Code.

}

Instead Of

int WinMain(){

    // Your Code.

}