First, let me give you a bit of a background story. For the past two weeks I’ve been trying to figure out why I am getting 16 unresolved external symbol errors for my GL commands in source code, thinking that OpenGL32.lib was not being linked correctly. I went through every possible option, posted on multiple forums asking for help to no avail of the solution. After a simple test the main helper on another forum posted for me to try, I’ve concluded that Opengl32.lib linkage was not the problem. Sorry if that seemed unneeded, I just want you to know I’m not asking without trying to fix the problem myself.
Okay, I have GL.h, GLU.h, and GLUT.h inside my VC\include directory of Visual Studio 2008. I created a windows project (non-console), and to test what the problem was I added a function definition of RenderScene (the book’s way of rendering a simple scene), while including GL.h into the code. Now I’m getting 4 unresolved external symbol errors, one for each GL function. Can you guys help me figure out what I’m doing wrong? Here’s the code that’s giving me the errors:
void RenderScene(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0f, 0.0f, 0.0f);
glRectf(-25.0f, 25.0f, 25.0f, -25.0f);
glFlush();
}
fjghjgjgjhg.obj : error LNK2019: unresolved external symbol __imp__glFlush@0 referenced in function “void __cdecl RenderScene(void)” (?RenderScene@@YAXXZ)
fjghjgjgjhg.obj : error LNK2019: unresolved external symbol __imp__glRectf@16 referenced in function “void __cdecl RenderScene(void)” (?RenderScene@@YAXXZ)
fjghjgjgjhg.obj : error LNK2019: unresolved external symbol __imp__glColor3f@12 referenced in function “void __cdecl RenderScene(void)” (?RenderScene@@YAXXZ)
fjghjgjgjhg.obj : error LNK2019: unresolved external symbol __imp__glClear@4 referenced in function “void __cdecl RenderScene(void)” (?RenderScene@@YAXXZ)
On my original program I’m simply getting four LNK2001 unresolved external symbols for those lines (16 total).