PDA

View Full Version : Compilation Error - OpenGL Superbible 4th Edition



thchua
08-30-2008, 03:58 AM
H, I am new to both VC++ and OpenGL. I bought the book "OpenGL Superbible (4th Edition)" and tried to compile the examples under Window Vista - MSVC++ 2008 (v9) using the project files provided. While simple exmaples compiled and run successfully, I am stucked with with example which use gltools.cpp. Compilation error :(

For example, while compiling "SphereWorld" in chapter 11, i get the following compilation error:

21 errors found while compiling gltools.cpp (example: error C3861: 'glDeleteObjectARB': identifier not found)

The source code for this particular project is too long to be posted here. Please kindly find the source here in
SB-AllSource.zip at http://www.starstonesoftware.com/OpenGL/.

Please help ....

The error message is posted below:


------ Rebuild All started: Project: SphereWorld, Configuration: Release Win32 ------
Deleting intermediate and output files for project 'SphereWorld', configuration 'Release|Win32'
Compiling...
cl : Command line warning D9035 : option 'Wp64' has been deprecated and will be removed in a future release
GLee.c
..\..\..\..\src\shared\GLee.c(9306) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files\Microsoft Visual Studio 9.0\VC\include\string.h(74) : see declaration of 'strcpy'
..\..\..\..\src\shared\GLee.c(9374) : warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files\Microsoft Visual Studio 9.0\VC\include\stdio.h(366) : see declaration of 'sprintf'
Compiling...
cl : Command line warning D9035 : option 'Wp64' has been deprecated and will be removed in a future release
math3d.cpp
gltools.cpp
..\..\..\..\src\shared\gltools.cpp(431) : warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files\Microsoft Visual Studio 9.0\VC\include\stdio.h(237) : see declaration of 'fopen'
..\..\..\..\src\shared\gltools.cpp(474) : warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files\Microsoft Visual Studio 9.0\VC\include\stdio.h(237) : see declaration of 'fopen'
..\..\..\..\src\shared\gltools.cpp(565) : warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files\Microsoft Visual Studio 9.0\VC\include\stdio.h(237) : see declaration of 'fopen'
..\..\..\..\src\shared\gltools.cpp(597) : error C3861: 'glShaderSourceARB': identifier not found
..\..\..\..\src\shared\gltools.cpp(616) : error C3861: 'glCreateShaderObjectARB': identifier not found
..\..\..\..\src\shared\gltools.cpp(617) : error C3861: 'glCreateShaderObjectARB': identifier not found
..\..\..\..\src\shared\gltools.cpp(622) : error C3861: 'glDeleteObjectARB': identifier not found
..\..\..\..\src\shared\gltools.cpp(623) : error C3861: 'glDeleteObjectARB': identifier not found
..\..\..\..\src\shared\gltools.cpp(629) : error C3861: 'glDeleteObjectARB': identifier not found
..\..\..\..\src\shared\gltools.cpp(630) : error C3861: 'glDeleteObjectARB': identifier not found
..\..\..\..\src\shared\gltools.cpp(635) : error C3861: 'glCompileShaderARB': identifier not found
..\..\..\..\src\shared\gltools.cpp(636) : error C3861: 'glCompileShaderARB': identifier not found
..\..\..\..\src\shared\gltools.cpp(639) : error C3861: 'glGetObjectParameterivARB': identifier not found
..\..\..\..\src\shared\gltools.cpp(642) : error C3861: 'glDeleteObjectARB': identifier not found
..\..\..\..\src\shared\gltools.cpp(643) : error C3861: 'glDeleteObjectARB': identifier not found
..\..\..\..\src\shared\gltools.cpp(647) : error C3861: 'glGetObjectParameterivARB': identifier not found
..\..\..\..\src\shared\gltools.cpp(650) : error C3861: 'glDeleteObjectARB': identifier not found
..\..\..\..\src\shared\gltools.cpp(651) : error C3861: 'glDeleteObjectARB': identifier not found
..\..\..\..\src\shared\gltools.cpp(656) : error C3861: 'glCreateProgramObjectARB': identifier not found
..\..\..\..\src\shared\gltools.cpp(657) : error C3861: 'glAttachObjectARB': identifier not found
..\..\..\..\src\shared\gltools.cpp(658) : error C3861: 'glAttachObjectARB': identifier not found
..\..\..\..\src\shared\gltools.cpp(659) : error C3861: 'glLinkProgramARB': identifier not found
..\..\..\..\src\shared\gltools.cpp(662) : error C3861: 'glDeleteObjectARB': identifier not found
..\..\..\..\src\shared\gltools.cpp(663) : error C3861: 'glDeleteObjectARB': identifier not found
sphereworld.cpp
..\..\..\..\src\chapt11\sphereworld\sphereworld.cp p(149) : warning C4305: 'argument' : truncation from 'double' to 'GLfloat'
..\..\..\..\src\chapt11\sphereworld\sphereworld.cp p(149) : warning C4305: 'argument' : truncation from 'double' to 'GLfloat'
..\..\..\..\src\chapt11\sphereworld\sphereworld.cp p(186) : warning C4244: '=' : conversion from 'GLfloat' to 'GLint', possible loss of data
..\..\..\..\src\chapt11\sphereworld\sphereworld.cp p(186) : warning C4244: '+=' : conversion from 'GLfloat' to 'GLint', possible loss of data
..\..\..\..\src\chapt11\sphereworld\sphereworld.cp p(191) : warning C4244: '=' : conversion from 'GLfloat' to 'GLint', possible loss of data
..\..\..\..\src\chapt11\sphereworld\sphereworld.cp p(191) : warning C4244: '-=' : conversion from 'GLfloat' to 'GLint', possible loss of data
..\..\..\..\src\chapt11\sphereworld\sphereworld.cp p(195) : warning C4244: 'argument' : conversion from 'GLint' to 'GLfloat', possible loss of data
..\..\..\..\src\chapt11\sphereworld\sphereworld.cp p(195) : warning C4244: 'argument' : conversion from 'GLint' to 'GLfloat', possible loss of data
..\..\..\..\src\chapt11\sphereworld\sphereworld.cp p(199) : warning C4244: 'argument' : conversion from 'GLint' to 'GLfloat', possible loss of data
..\..\..\..\src\chapt11\sphereworld\sphereworld.cp p(258) : warning C4305: 'argument' : truncation from 'double' to 'GLfloat'
..\..\..\..\src\chapt11\sphereworld\sphereworld.cp p(258) : warning C4305: 'argument' : truncation from 'double' to 'GLfloat'
..\..\..\..\src\chapt11\sphereworld\sphereworld.cp p(324) : warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files\Microsoft Visual Studio 9.0\VC\include\stdio.h(366) : see declaration of 'sprintf'
..\..\..\..\src\chapt11\sphereworld\sphereworld.cp p(326) : warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files\Microsoft Visual Studio 9.0\VC\include\stdio.h(366) : see declaration of 'sprintf'
Generating Code...
Build log was saved at "file://c:\Users\SonySty\Desktop\examples\projects\microso ft\chapt11\SphereWorld\Release\BuildLog.htm"
SphereWorld - 21 error(s), 20 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

ZbuffeR
08-30-2008, 04:14 AM
I am not used to MSVC9 messages, but it looks like you miss the headers for GL 2 :
http://www.opengl.org/registry/api/glext.h
http://www.opengl.org/registry/api/wglext.h

If this does not help, then you have to fix how the extended GL functions are retrieved. You can have a look to glee or glew to make it easy.

Some background on the subject :
http://www.opengl.org/wiki/index.php/Getting_started#OpenGL_2.0_and_extensions