PDA

View Full Version : OpenGL and Visual Studio .NET



02-05-2003, 04:44 AM
When using the 2 includes that I need for a program, (gl.h, and glu.h) vs.net stops compiling with 102 errors in gl.h. What is the deal? Has anyone encountered this, and how can I fix it. Thanks!

02-05-2003, 06:00 AM
Have you linked the necessary DLLs? That could be your problem. In Visual Studio .NET you have to goto project properties and goto link and type the names of the *.dll files.
-LoGiK

Deiussum
02-05-2003, 06:22 AM
For OpenGL you should be linking to .lib files, not the .DLL files.

You say the errors are in gl.h, so I'm guessing what you probably didn't do is to #include <windows.h> BEFORE #include <GL/gl.h>. Windows.h contains some #defined stuff that is used in gl.h.

bakery2k
02-05-2003, 06:22 AM
#include <windows.h> before <GL/gl.h>

HalcyonBlaze
02-05-2003, 07:28 AM
#include <windows.h>
#include <gl\gl.h>
#include <gl\glu.h>
#include <gl\glaux.h>

#pragma comment (lib, "opengl32")
#pragma comment (lib, "glu32")
#pragma comment (lib, "glaux")




This code will take care of loading the header files AND linking the libraries. If this doesn't work, then something else is wrong. Maybe you are missing a '}' or a ';' somewhere. Look at the first few errors that come up. Those are usualy indicative of the real error that causes problems. If what i put in for ya isn't the solution, can you post a few of the errors that you are getting?

- Halcyon

02-05-2003, 09:51 PM
Thanks, that helped. It now compiles correctly.