PDA

View Full Version : GL file is not being found? Unresolved External Sy



Lvl80retpaladin
02-18-2010, 09:01 PM
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).

Macadameane
02-19-2010, 10:48 AM
I'm having the same problem

vivek vyas
02-19-2010, 10:56 AM
it worked with "console" new empty project
atleast in my system ;)

Lvl80retpaladin
02-20-2010, 12:12 PM
Not for me. I have GL, GLU, and GLUT in my 'header file' section of my project and I have those headers located in VC\include; apparently they're not being found because I'm still getting 16 various unresolved external symbols? Can you give me some advice?

Lvl80retpaladin
02-20-2010, 12:15 PM
Last minute note, I am able to compile sucessfully. Building the project is what gives me the erorrs.

mark ds
02-20-2010, 12:32 PM
add

#pragma comment( lib, "opengl32.lib" )

to the top of your souce file, or add a reference to it in

project->properties...
configuration properties->linker->input->additional dependancies