编译报错如下:
error C2144: syntax error : 'void' should be preceded by ';'
Error C2144 syntax error: 'void' should be preceded by ';' OpenGLTutorial c:\program files (x86)\windows kits\8.1\include\um\gl\gl.h 1157
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int OpenGLTutorial c:\program files (x86)\windows kits\8.1\include\um\gl\gl.h 1157
Error C2182 'APIENTRY': illegal use of type 'void' OpenGLTutorial c:\program files (x86)\windows kits\8.1\include\um\gl\gl.h 1157
Error C2146 syntax error: missing ';' before identifier 'glAccum' OpenGLTutorial c:\program files (x86)\windows kits\8.1\include\um\gl\gl.h 1157
Error C2144 syntax error: 'void' should be preceded by ';' OpenGLTutorial c:\program files (x86)\windows kits\8.1\include\um\gl\gl.h 1157
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int OpenGLTutorial c:\program files (x86)\windows kits\8.1\include\um\gl\gl.h 1157
Error C2182 'APIENTRY': illegal use of type 'void' OpenGLTutorial c:\program files (x86)\windows kits\8.1\include\um\gl\gl.h 1157
Error C2146 syntax error: missing ';' before identifier 'glAccum' OpenGLTutorial c:\program files (x86)\windows kits\8.1\include\um\gl\gl.h 1157
解决方法:
包含windows.h
如:
#ifdef _WIN32
#include <windows.h>
#endif
#include <gl/GL.h>
#include <gl/GLU.h>