You are on page 1of 2

Microsoft Visual C++ users, but the types of errors can apply, in general, to any platform.

Example error text d:\c++\file.c(20) : warning C4013: 'glutDestroyWindow' undefined; assuming extern returning int d:\c++\file.c(71) : warning C4013: 'glMatrixMode' undefined; assuming extern returning int d:\c++\file.c(71) : error C2065: 'GL_MODELVIEW' : undeclared identifier c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1152) : error C2054: expected '(' to follow 'WINGDIAPI' c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1152) : error C2085: 'APIENTRY' : not in formal parameter list d:c++\file.c(231) : warning C4305: 'initializing' : truncation from 'const double ' to 'float ' Possible cause and solution Didn't #include gl.h, glu.h, or glut.h A GLUT source file should: #include <GL/glut.h> Non-GLUT source files should: #include <GL/glu.h> #include <GL/gl.h> Didn't #include windows.h or included it after gl.h. Source files that use neither GLUT nor MFC, but which make calls to OpenGL, should: #include <windows.h> #include <GL/gl.h> Floating-point constants (e.g., 1.0) default to type double. This is a harmless warning that can be disabled in Visual C++ with: #ifdef WIN32 #pragma warning( disable : 4305) #endif at the top of the source file. Didn't link with opengl32.lib, glu32.lib, or glut32.lib. Section 2.060 above describes how to inform the Visual C++ 6 linker about the location of the .lib files.

file.obj : error LNK2001: unresolved external symbol __imp__glMatrixMode@4 file.obj : error LNK2001: unresolved external symbol __imp__glViewport@16 file.obj : error LNK2001: unresolved external symbol __imp__glLoadIdentity@0

The dynamic link library OPENGL.dll could Failure to correctly install .dll files. See section 2.060 not be found in the specified path.. above for information on where these files should be installed for your Windows system. Nothing renders, just a blank window. Mixed linkage against .lib files from both Microsoft and SGI can cause this. Make sure you specify either glut32.lib, glu32.lib opengl32.lib or glut.lib, glu.lib, and opengl.lib to the linker, but not a combination of the files from these two file sets. Not an OpenGL question per se, but definitely a FAQ on comp.graphics.api.opengl due to the way GLUT

LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16

Debug/test.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe.

works in Microsoft Windows. You should instruct your compiler to build a console application. It's trying to find the Win32 entry point, but your code wasn't written as a Win32 application. Set the CS_OWNDC style in the PreCreate*() routines in the view class. Add the following to your app before you call any OpenGL functions: _control87(MCW_EM, MCW_EM); This is from Borland's own FAQ article #17197.

Multiple access violations appear when running a Microsoft OpenGL MFC-based application. Floating-point exceptions occur at runtime. The application was built with Borland C.

You might also like