Bunch of linking errors: #2019

I include these header files at the beginning of my project main.cpp:


#include <gl\gl.h>			// Header File For The OpenGL32 Library
#include <gl\glu.h>			// Header File For The GLu32 Library
#include <gl\glaux.h>		// Header File For The Glaux Library

Main.obj : error LNK2019: unresolved external symbol __imp__glLoadIdentity@0 referenced in function "void __cdecl ReSizeGLScene(int,int)" (?ReSizeGLScene@@YAXHH@Z)
Main.obj : error LNK2019: unresolved external symbol __imp__glMatrixMode@4 referenced in function "void __cdecl ReSizeGLScene(int,int)" (?ReSizeGLScene@@YAXHH@Z)
Main.obj : error LNK2019: unresolved external symbol __imp__glViewport@16 referenced in function "void __cdecl ReSizeGLScene(int,int)" (?ReSizeGLScene@@YAXHH@Z)
Main.obj : error LNK2019: unresolved external symbol __imp__glHint@8 referenced in function "int __cdecl InitGL(void)" (?InitGL@@YAHXZ)
Main.obj : error LNK2019: unresolved external symbol __imp__glDepthFunc@4 referenced in function "int __cdecl InitGL(void)" (?InitGL@@YAHXZ)
Main.obj : error LNK2019: unresolved external symbol __imp__glEnable@4 referenced in function "int __cdecl InitGL(void)" (?InitGL@@YAHXZ)

I’m sure it has to do with either me not having the opengl files I need, or if my project settings are incorrect. I’m working with Visual Studio 2005 express C++. Any ideas why this is happening?

You need to add opengl32.lib and glu32.lib to the linker dependencies of your project. Here’s and example of how to do this in VS 2003.

N.

Mmk, I resolved that issue, I think it’s finding my dependencies now, but now I’m getting this linker error.

LINK : fatal error LNK1104: cannot open file ‘;.obj’

Any ideas on that one?
I looked at help and it wasn’t very helpful lol.

Maybe you put a ; character where it doesn’t belong, probably in the link command…

N.

Fixed the dependency issues, but now I have a question, If my project was already set as a precompiled header, will I be able to use win_main

I’m getting an error:

MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup

Google is your friend :slight_smile:

N.