完全按照这里提到的步骤,我得到 243 错误?!发生了什么?
Error 1 error C2144: syntax error : 'void' should be preceded by ';' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1152 Win32OpenGL 1
Error 2 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1152 Win32OpenGL 1
Error 3 error C2146: syntax error : missing ';' before identifier 'glAccum' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1152 Win32OpenGL 1
Error 4 error C2182: 'APIENTRY' : illegal use of type 'void' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1152 Win32OpenGL 1
Error 5 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1152 Win32OpenGL 1
Error 6 error C2144: syntax error : 'void' should be preceded by ';' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1153 Win32OpenGL 1
Error 7 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1153 Win32OpenGL 1
Error 8 error C2086: 'int WINGDIAPI' : redefinition c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1153 Win32OpenGL 1
Error 9 error C2146: syntax error : missing ';' before identifier 'glAlphaFunc' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1153 Win32OpenGL 1
Error 10 error C2182: 'APIENTRY' : illegal use of type 'void' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1153 Win32OpenGL 1
Error 11 error C2086: 'int APIENTRY' : redefinition c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1153 Win32OpenGL 1
Error 12 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1153 Win32OpenGL 1
Error 13 error C2146: syntax error : missing ';' before identifier 'GLboolean' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1154 Win32OpenGL 1
Error 14 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1154 Win32OpenGL 1
Error 15 error C2086: 'int WINGDIAPI' : redefinition c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1154 Win32OpenGL 1
Error 16 error C2146: syntax error : missing ';' before identifier 'glAreTexturesResident' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1154 Win32OpenGL 1
Error 17 error C2371: 'APIENTRY' : redefinition; different basic types c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h 1154 Win32OpenGL 1
等等。您会看到 gl.h 中发生的所有错误都不是我实现的!我创建了一个 win32 应用程序空项目,向其中添加了一个源文件,而 .cpp 文件中只有这些代码。
#include <gl\GL.h>
#include <gl\GLU.h>
#include <gl\glut.h>
int main()
{
return 0;
}