- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
最近我得到了 OpenGL SuperBible 第 5 版。很高兴我开始阅读,当我读到关于如何正确设置所有内容的第一部分时,我遇到了一些 Google 和其他 StackOverflow 问题都无法回答的问题。
我想澄清一下,我使用的是 Visual Studio 2010 并且所有内容都已正确链接。
我已经从 OpenGL Superbible 官方网站下载了库和头文件。
所以当我编写第一个名为 Triangle.cpp 的程序并尝试编译它时,它给出了以下错误。
1>------ Build started: Project: OpenGL, Configuration: Debug Win32 ------
1>Build started 7/19/2011 9:21:27 PM.
1>InitializeBuildStatus:
1> Touching "Debug\OpenGL.unsuccessfulbuild".
1>ClCompile:
1> Triangle.cpp
1>c:\sb5\src\gltools\include\glbatch.h(77): error C2061: syntax error : identifier 'GLenum'
1>c:\sb5\src\gltools\include\glbatch.h(86): error C2061: syntax error : identifier 'GLuint'
1>c:\sb5\src\gltools\include\glbatch.h(89): error C2061: syntax error : identifier 'GLfloat'
1>c:\sb5\src\gltools\include\glbatch.h(90): error C2061: syntax error : identifier 'GLfloat'
1>c:\sb5\src\gltools\include\glbatch.h(91): error C2061: syntax error : identifier 'GLfloat'
1>c:\sb5\src\gltools\include\glbatch.h(92): error C2061: syntax error : identifier 'GLfloat'
1>c:\sb5\src\gltools\include\glbatch.h(100): error C2061: syntax error : identifier 'GLfloat'
1>c:\sb5\src\gltools\include\glbatch.h(103): error C2061: syntax error : identifier 'GLfloat'
1>c:\sb5\src\gltools\include\glbatch.h(106): error C2061: syntax error : identifier 'GLfloat'
1>c:\sb5\src\gltools\include\glbatch.h(109): error C2061: syntax error : identifier 'GLuint'
1>c:\sb5\src\gltools\include\glbatch.h(110): error C2061: syntax error : identifier 'GLuint'
1>c:\sb5\src\gltools\include\glbatch.h(113): error C2146: syntax error : missing ';' before identifier 'primitiveType'
1>c:\sb5\src\gltools\include\glbatch.h(113): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\glbatch.h(113): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\glbatch.h(115): error C2146: syntax error : missing ';' before identifier 'uiVertexArray'
1>c:\sb5\src\gltools\include\glbatch.h(115): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\glbatch.h(115): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\glbatch.h(116): error C2146: syntax error : missing ';' before identifier 'uiNormalArray'
1>c:\sb5\src\gltools\include\glbatch.h(116): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\glbatch.h(116): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\glbatch.h(117): error C2146: syntax error : missing ';' before identifier 'uiColorArray'
1>c:\sb5\src\gltools\include\glbatch.h(117): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\glbatch.h(117): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\glbatch.h(118): error C2143: syntax error : missing ';' before '*'
1>c:\sb5\src\gltools\include\glbatch.h(118): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\glbatch.h(118): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\glbatch.h(119): error C2146: syntax error : missing ';' before identifier 'vertexArrayObject'
1>c:\sb5\src\gltools\include\glbatch.h(119): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\glbatch.h(119): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\glbatch.h(121): error C2146: syntax error : missing ';' before identifier 'nVertsBuilding'
1>c:\sb5\src\gltools\include\glbatch.h(121): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\glbatch.h(121): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\glbatch.h(122): error C2146: syntax error : missing ';' before identifier 'nNumVerts'
1>c:\sb5\src\gltools\include\glbatch.h(122): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\glbatch.h(122): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\glbatch.h(123): error C2146: syntax error : missing ';' before identifier 'nNumTextureUnits'
1>c:\sb5\src\gltools\include\glbatch.h(123): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\glbatch.h(123): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\glbatch.h(89): error C2065: 'vVerts' : undeclared identifier
1>c:\sb5\src\gltools\include\glbatch.h(90): error C2065: 'vNorms' : undeclared identifier
1>c:\sb5\src\gltools\include\glbatch.h(91): error C2065: 'vColors' : undeclared identifier
1>c:\sb5\src\gltools\include\glbatch.h(92): error C2065: 'vTex' : undeclared identifier
1>c:\sb5\src\gltools\include\glbatch.h(92): error C2065: 'uiTextureLayer' : undeclared identifier
1>c:\sb5\src\gltools\include\glshadermanager.h(85): error C2146: syntax error : missing ';' before identifier 'uiShaderID'
1>c:\sb5\src\gltools\include\glshadermanager.h(85): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\glshadermanager.h(85): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\glshadermanager.h(99): error C2146: syntax error : missing ';' before identifier 'GetStockShader'
1>c:\sb5\src\gltools\include\glshadermanager.h(99): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\glshadermanager.h(99): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\glshadermanager.h(99): warning C4183: 'GetStockShader': missing return type; assumed to be a member function returning 'int'
1>c:\sb5\src\gltools\include\glshadermanager.h(102): error C2146: syntax error : missing ';' before identifier 'UseStockShader'
1>c:\sb5\src\gltools\include\glshadermanager.h(102): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\glshadermanager.h(102): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\glshadermanager.h(102): warning C4183: 'UseStockShader': missing return type; assumed to be a member function returning 'int'
1>c:\sb5\src\gltools\include\glshadermanager.h(107): error C2146: syntax error : missing ';' before identifier 'LoadShaderPair'
1>c:\sb5\src\gltools\include\glshadermanager.h(107): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\glshadermanager.h(107): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\glshadermanager.h(107): warning C4183: 'LoadShaderPair': missing return type; assumed to be a member function returning 'int'
1>c:\sb5\src\gltools\include\glshadermanager.h(110): error C2146: syntax error : missing ';' before identifier 'LoadShaderPairSrc'
1>c:\sb5\src\gltools\include\glshadermanager.h(110): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\glshadermanager.h(110): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\glshadermanager.h(110): warning C4183: 'LoadShaderPairSrc': missing return type; assumed to be a member function returning 'int'
1>c:\sb5\src\gltools\include\glshadermanager.h(113): error C2146: syntax error : missing ';' before identifier 'LoadShaderPairWithAttributes'
1>c:\sb5\src\gltools\include\glshadermanager.h(113): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\glshadermanager.h(113): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\glshadermanager.h(113): warning C4183: 'LoadShaderPairWithAttributes': missing return type; assumed to be a member function returning 'int'
1>c:\sb5\src\gltools\include\glshadermanager.h(114): error C2146: syntax error : missing ';' before identifier 'LoadShaderPairSrcWithAttributes'
1>c:\sb5\src\gltools\include\glshadermanager.h(114): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\glshadermanager.h(114): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\glshadermanager.h(114): warning C4183: 'LoadShaderPairSrcWithAttributes': missing return type; assumed to be a member function returning 'int'
1>c:\sb5\src\gltools\include\glshadermanager.h(117): error C2146: syntax error : missing ';' before identifier 'LookupShader'
1>c:\sb5\src\gltools\include\glshadermanager.h(117): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\glshadermanager.h(117): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\glshadermanager.h(117): warning C4183: 'LookupShader': missing return type; assumed to be a member function returning 'int'
1>c:\sb5\src\gltools\include\glshadermanager.h(120): error C2146: syntax error : missing ';' before identifier 'uiStockShaders'
1>c:\sb5\src\gltools\include\glshadermanager.h(120): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\glshadermanager.h(120): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\gltrianglebatch.h(96): error C2061: syntax error : identifier 'GLuint'
1>c:\sb5\src\gltools\include\gltrianglebatch.h(101): error C2146: syntax error : missing ';' before identifier 'GetIndexCount'
1>c:\sb5\src\gltools\include\gltrianglebatch.h(101): error C2433: 'GLTriangleBatch::GLuint' : 'inline' not permitted on data declarations
1>c:\sb5\src\gltools\include\gltrianglebatch.h(101): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\gltrianglebatch.h(101): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\gltrianglebatch.h(101): warning C4183: 'GetIndexCount': missing return type; assumed to be a member function returning 'int'
1>c:\sb5\src\gltools\include\gltrianglebatch.h(102): error C2146: syntax error : missing ';' before identifier 'GetVertexCount'
1>c:\sb5\src\gltools\include\gltrianglebatch.h(102): error C2433: 'GLTriangleBatch::GLuint' : 'inline' not permitted on data declarations
1>c:\sb5\src\gltools\include\gltrianglebatch.h(102): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\gltrianglebatch.h(102): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\gltrianglebatch.h(102): warning C4183: 'GetVertexCount': missing return type; assumed to be a member function returning 'int'
1>c:\sb5\src\gltools\include\gltrianglebatch.h(109): error C2143: syntax error : missing ';' before '*'
1>c:\sb5\src\gltools\include\gltrianglebatch.h(109): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\gltrianglebatch.h(109): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\gltrianglebatch.h(114): error C2146: syntax error : missing ';' before identifier 'nMaxIndexes'
1>c:\sb5\src\gltools\include\gltrianglebatch.h(114): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\gltrianglebatch.h(114): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\gltrianglebatch.h(115): error C2146: syntax error : missing ';' before identifier 'nNumIndexes'
1>c:\sb5\src\gltools\include\gltrianglebatch.h(115): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\gltrianglebatch.h(115): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\gltrianglebatch.h(116): error C2146: syntax error : missing ';' before identifier 'nNumVerts'
1>c:\sb5\src\gltools\include\gltrianglebatch.h(116): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\gltrianglebatch.h(116): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\gltrianglebatch.h(118): error C2146: syntax error : missing ';' before identifier 'bufferObjects'
1>c:\sb5\src\gltools\include\gltrianglebatch.h(118): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\gltrianglebatch.h(118): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\gltrianglebatch.h(119): error C2146: syntax error : missing ';' before identifier 'vertexArrayBufferObject'
1>c:\sb5\src\gltools\include\gltrianglebatch.h(119): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\gltrianglebatch.h(119): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\gltrianglebatch.h(101): error C2065: 'nNumIndexes' : undeclared identifier
1>c:\sb5\src\gltools\include\gltrianglebatch.h(102): error C2065: 'nNumVerts' : undeclared identifier
1>c:\sb5\src\gltools\include\gltools.h(144): error C2065: 'GLint' : undeclared identifier
1>c:\sb5\src\gltools\include\gltools.h(144): error C2065: 'nMajor' : undeclared identifier
1>c:\sb5\src\gltools\include\gltools.h(144): error C2065: 'GLint' : undeclared identifier
1>c:\sb5\src\gltools\include\gltools.h(144): error C2065: 'nMinor' : undeclared identifier
1>c:\sb5\src\gltools\include\gltools.h(144): error C2182: 'gltGetOpenGLVersion' : illegal use of type 'void'
1>c:\sb5\src\gltools\include\gltools.h(144): error C2078: too many initializers
1>c:\sb5\src\gltools\include\gltools.h(153): error C2143: syntax error : missing ';' before '*'
1>c:\sb5\src\gltools\include\gltools.h(153): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\gltools.h(153): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\gltools.h(157): error C2143: syntax error : missing ';' before '*'
1>c:\sb5\src\gltools\include\gltools.h(157): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\gltools.h(157): error C2086: 'int GLbyte' : redefinition
1> c:\sb5\src\gltools\include\gltools.h(153) : see declaration of 'GLbyte'
1>c:\sb5\src\gltools\include\gltools.h(157): error C2061: syntax error : identifier 'GLint'
1>c:\sb5\src\gltools\include\gltools.h(157): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\gltools.h(162): error C2146: syntax error : missing ';' before identifier 'gltGrabScreenTGA'
1>c:\sb5\src\gltools\include\gltools.h(162): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\gltools.h(162): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\gltools.h(167): error C2061: syntax error : identifier 'GLfloat'
1>c:\sb5\src\gltools\include\gltools.h(168): error C2061: syntax error : identifier 'GLfloat'
1>c:\sb5\src\gltools\include\gltools.h(169): error C2061: syntax error : identifier 'GLfloat'
1>c:\sb5\src\gltools\include\gltools.h(170): error C2061: syntax error : identifier 'GLfloat'
1>c:\sb5\src\gltools\include\gltools.h(171): error C2061: syntax error : identifier 'GLfloat'
1>c:\sb5\src\gltools\include\gltools.h(174): error C2061: syntax error : identifier 'GLuint'
1>c:\sb5\src\gltools\include\gltools.h(175): error C2061: syntax error : identifier 'GLuint'
1>c:\sb5\src\gltools\include\gltools.h(177): error C2146: syntax error : missing ';' before identifier 'gltLoadShaderPair'
1>c:\sb5\src\gltools\include\gltools.h(177): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\gltools.h(177): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\gltools.h(178): error C2146: syntax error : missing ';' before identifier 'gltLoadShaderPairWithAttributes'
1>c:\sb5\src\gltools\include\gltools.h(178): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\gltools.h(178): error C2086: 'int GLuint' : redefinition
1> c:\sb5\src\gltools\include\gltools.h(177) : see declaration of 'GLuint'
1>c:\sb5\src\gltools\include\gltools.h(178): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\gltools.h(180): error C2146: syntax error : missing ';' before identifier 'gltLoadShaderPairSrc'
1>c:\sb5\src\gltools\include\gltools.h(180): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\gltools.h(180): error C2086: 'int GLuint' : redefinition
1> c:\sb5\src\gltools\include\gltools.h(177) : see declaration of 'GLuint'
1>c:\sb5\src\gltools\include\gltools.h(180): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\gltools.h(181): error C2146: syntax error : missing ';' before identifier 'gltLoadShaderPairSrcWithAttributes'
1>c:\sb5\src\gltools\include\gltools.h(181): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\gltools.h(181): error C2086: 'int GLuint' : redefinition
1> c:\sb5\src\gltools\include\gltools.h(177) : see declaration of 'GLuint'
1>c:\sb5\src\gltools\include\gltools.h(181): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\sb5\src\gltools\include\gltools.h(183): error C2146: syntax error : missing ')' before identifier 'progName'
1>c:\sb5\src\gltools\include\gltools.h(183): warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
1>c:\sb5\src\gltools\include\gltools.h(183): error C2059: syntax error : ')'
1>c:\sb5\src\gltools\include\gltools.h(184): error C2146: syntax error : missing ')' before identifier 'width'
1>c:\sb5\src\gltools\include\gltools.h(184): error C2182: 'gltGenerateOrtho2DMat' : illegal use of type 'void'
1>c:\sb5\src\gltools\include\gltools.h(184): error C2059: syntax error : ')'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h(46): error C2378: 'GLbyte' : redefinition; symbol cannot be overloaded with a typedef
1> c:\sb5\src\gltools\include\gltools.h(153) : see declaration of 'GLbyte'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h(48): error C2378: 'GLint' : redefinition; symbol cannot be overloaded with a typedef
1> c:\sb5\src\gltools\include\gltools.h(162) : see declaration of 'GLint'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h(52): error C2378: 'GLuint' : redefinition; symbol cannot be overloaded with a typedef
1> c:\sb5\src\gltools\include\gltools.h(177) : see declaration of 'GLuint'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h(1154): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h(1154): error C2143: syntax error : missing ',' before '*'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h(1155): error C2146: syntax error : missing ')' before identifier 'i'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h(1155): warning C4229: anachronism used : modifiers on data are ignored
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h(1155): error C2182: 'glArrayElement' : illegal use of type 'void'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h(1155): error C2491: 'glArrayElement' : definition of dllimport data not allowed
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h(1155): error C2059: syntax error : ')'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h(1157): error C2061: syntax error : identifier 'GLuint'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h(1160): error C2146: syntax error : missing ')' before identifier 'list'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h(1160): warning C4229: anachronism used : modifiers on data are ignored
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h(1160): error C2182: 'glCallList' : illegal use of type 'void'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h(1160): error C2491: 'glCallList' : definition of dllimport data not allowed
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h(1160): error C2059: syntax error : ')'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h(1167): error C2146: syntax error : missing ')' before identifier 's'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h(1167): warning C4229: anachronism used : modifiers on data are ignored
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h(1167): error C2182: 'glClearStencil' : illegal use of type 'void'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h(1167): error C2491: 'glClearStencil' : definition of dllimport data not allowed
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h(1167): error C2059: syntax error : ')'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h(1169): error C2146: syntax error : missing ')' before identifier 'red'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h(1169): warning C4229: anachronism used : modifiers on data are ignored
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h(1169): error C2182: 'glColor3b' : illegal use of type 'void'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h(1169): error C2491: 'glColor3b' : definition of dllimport data not allowed
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h(1169): error C2059: syntax error : ')'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h(1170): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h(1170): error C2143: syntax error : missing ',' before '*'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h(1175): error C2146: syntax error : missing ')' before identifier 'red'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h(1175): warning C4229: anachronism used : modifiers on data are ignored
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h(1175): error C2182: 'glColor3i' : illegal use of type 'void'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h(1175): fatal error C1003: error count exceeds 100; stopping compilation
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.67
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
标题本身似乎有问题,即使我是从官方网站下载的。我还尝试在 Visual Studio 2010 C++ Express 中编译相同的代码并出现相同的错误。我不想使用 Code::blocks,因为我发现使用类似的东西没有任何优势。这一切似乎很麻烦。我更喜欢在 Visual Studio 中工作。
编辑(添加源代码):
// Triangle.cpp
// Our first OpenGL program that will just draw a triangle on the screen.
#include <GLTools.h> // OpenGL toolkit
#include <GLShaderManager.h> // Shader Manager Class
#ifdef __APPLE__
#include <glut/glut.h> // OS X version of GLUT
#else
#define FREEGLUT_STATIC
#include <GL/glut.h> // Windows FreeGlut equivalent
#endif
GLBatch triangleBatch;
GLShaderManager shaderManager;
///////////////////////////////////////////////////////////////////////////////
// Window has changed size, or has just been created. In either case, we need
// to use the window dimensions to set the viewport and the projection matrix.
void ChangeSize(int w, int h)
{
glViewport(0, 0, w, h);
}
///////////////////////////////////////////////////////////////////////////////
// This function does any needed initialization on the rendering context.
// This is the first opportunity to do any OpenGL related tasks.
void SetupRC()
{
// Blue background
glClearColor(0.0f, 0.0f, 1.0f, 1.0f );
shaderManager.InitializeStockShaders();
// Load up a triangle
GLfloat vVerts[] = { -0.5f, 0.0f, 0.0f,
0.5f, 0.0f, 0.0f,
0.0f, 0.5f, 0.0f };
triangleBatch.Begin(GL_TRIANGLES, 3);
triangleBatch.CopyVertexData3f(vVerts);
triangleBatch.End();
}
///////////////////////////////////////////////////////////////////////////////
// Called to draw scene
void RenderScene(void)
{
// Clear the window with current clearing color
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
GLfloat vRed[] = { 1.0f, 0.0f, 0.0f, 1.0f };
shaderManager.UseStockShader(GLT_SHADER_IDENTITY, vRed);
triangleBatch.Draw();
// Perform the buffer swap to display back buffer
glutSwapBuffers();
}
///////////////////////////////////////////////////////////////////////////////
// Main entry point for GLUT based programs
int main(int argc, char* argv[])
{
gltSetWorkingDirectory(argv[0]);
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_STENCIL);
glutInitWindowSize(800, 600);
glutCreateWindow("Triangle");
glutReshapeFunc(ChangeSize);
glutDisplayFunc(RenderScene);
GLenum err = glewInit();
if (GLEW_OK != err) {
fprintf(stderr, "GLEW Error: %s\n", glewGetErrorString(err));
return 1;
}
SetupRC();
glutMainLoop();
return 0;
}
最佳答案
当第一次在 Windows 操作系统上使用 OpenGL 的用户开始开发他们的软件时,您看到的错误确实经常出现。虽然在这种情况下,错误消息被 glbatch.h 略微掩盖了,通常错误会指向 gl.h。
如果您使用的是 Windows,请确保在包含 gl.h
或任何其他可能间接包含 gl.h 的文件之前包含 windows.h
。
如 MSDN 所述,这是 OpenGL 工作所必需的。
关于c++ - OpenGL SuperBible 头文件问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6753366/
关闭。这个问题是off-topic .它目前不接受答案。 想要改进这个问题? Update the question所以它是on-topic用于堆栈溢出。 关闭 12 年前。 Improve thi
我有一个动态网格,其中的数据功能需要正常工作,这样我才能逐步复制网格中的数据。假设在第 5 行中,我输入 10,则从第 6 行开始的后续行应从 11 开始读取,依此类推。 如果我转到空白的第一行并输入
我有一个关于我的按钮消失的问题 我已经把一个图像作为我的按钮 用这个函数动画 function example_animate(px) { $('#cont
我有一个具有 Facebook 连接和经典用户名/密码登录的网站。目前,如果用户单击 facebook_connect 按钮,系统即可运行。但是,我想将现有帐户链接到 facebook,因为用户可以选
我有一个正在为 iOS 开发的应用程序,该应用程序执行以下操作 加载和设置注释并启动核心定位和缩放到位置。 map 上有很多注释,从数据加载不会花很长时间,但将它们实际渲染到 map 上需要一段时间。
我被推荐使用 Heroku for Ruby on Rails 托管,到目前为止,我认为我真的会喜欢它。只是想知道是否有人可以帮助我找出问题所在。 我按照那里的说明在该网站上创建应用程序,创建并提交
我看过很多关于 SSL 错误的帖子和信息,我自己也偶然发现了一个。 我正在尝试使用 GlobalSign CA BE 证书通过 Android WebView 访问网页,但出现了不可信错误。 对于大多
我想开始使用 OpenGL 3+ 和 4,但我在使用 Glew 时遇到了问题。我试图将 glew32.lib 包含在附加依赖项中,并且我已将库和 .dll 移动到主文件夹中,因此不应该有任何路径问题。
我已经盯着这两个下载页面的源代码看了一段时间,但我似乎找不到问题。 我有两个下载页面,一个 javascript 可以工作,一个没有。 工作:http://justupload.it/v/lfd7不是
我一直在使用 jQuery,只是尝试在单击链接时替换文本字段以及隐藏/显示内容项。它似乎在 IE 中工作得很好,但我似乎无法让它在 FF 中工作。 我的 jQuery: $(function() {
我正在尝试为 NDK 编译套接字库,但出现以下两个错误: error: 'close' was not declared in this scope 和 error: 'min' is not a m
我正在使用 Selenium 浏览器自动化框架测试网站。在测试过程中,我切换到特定的框架,我们将其称为“frame_1”。后来,我在 Select 类中使用了 deselectAll() 方法。不久之
我正在尝试通过 Python 创建到 Heroku PostgreSQL 数据库的连接。我将 Windows10 与 Python 3.6.8 和 PostgreSQL 9.6 一起使用。 我从“ht
我有一个包含 2 列的数据框,我想根据两列之间的比较创建第三列。 所以逻辑是:第 1 列 val = 3,第 2 列 val = 4,因此新列值什么都没有 第 1 列 val = 3,第 2 列 va
我想知道如何调试 iphone 5 中的 css 问题。 我尝试使用 firelite 插件。但是从纵向旋转到横向时,火石占据了整个屏幕。 有没有其他方法可以调试 iphone 5 中的 css 问题
所以我有点难以理解为什么这不起作用。我正在尝试替换我正在处理的示例站点上的类别复选框。我试图让它做以下事情:未选中时以一种方式出现,悬停时以另一种方式出现(选中或未选中)选中时以第三种方式出现(而不是
Javascript CSS 问题: 我正在使用一个文本框来写入一个 div。我使用以下 javascript 获取文本框来执行此操作: function process_input(){
你好,我很难理解 P、NP 和多项式时间缩减的主题。我试过在网上搜索它并问过我的一些 friend ,但我没有得到任何好的答案。 我想问一个关于这个话题的一般性问题: 设 A,B 为 P 中的语言(或
你好,我一直在研究 https://leetcode.com/problems/2-keys-keyboard/并想到了这个动态规划问题。 您从空白页上的“A”开始,完成后得到一个数字 n,页面上应该
我正在使用 Cocoapods 和 KIF 在 Xcode 服务器上运行持续集成。我已经成功地为一个项目设置了它来报告每次提交。我现在正在使用第二个项目并收到错误: Bot Issue: warnin
我是一名优秀的程序员,十分优秀!