PDA

View Full Version : Some Basic OpenGL question for a beginer



Hobbes7714
10-06-2002, 06:41 PM
I just got a book on OpenGL (The OpenGL SuperBible) and as I was going through it I decide to try and compile the code for a program called Solar. I've insalled all of the headers and .libs and .dlls that came with the book on a CD, and the comilier gave me 94 errors and 17 warrings, most of which came from enumerations.h, though a few came from gl.h. Also I've been having problems compiling the OpenGL math.h. Finnaly, I have to write the normal #include <gl/glut.h> as #include <gl.h> #include <glut.h> because the compilier "Cannot open include file: 'gl/glut.h'" and I'm not sure what to do about that.

Thanks for whatever help you can give me.

Hobbes http://www.opengl.org/discussion_boards/ubb/smile.gif

Hobbes7714
10-06-2002, 06:47 PM
Ohh, the errors that I've beeng etting for the math.h change, the last time I tried to compile it, I only got one error, which was: "error C2065: 'floor' : undeclared identifier."

Hobbes http://www.opengl.org/discussion_boards/ubb/smile.gif

ioquan
10-06-2002, 10:30 PM
If you are compiling on Windows, you will need to include windows.h. GL.h will not compile on windows unless windows.h is included first.

Math.h is not part of OpenGL, it came with your compiler. I dont know why you'd be getting errors there.

Before you dive into 3d graphics, you might want to take some time to learn basic stuff like how to include files.

[This message has been edited by ioquan (edited 10-06-2002).]

Richa
10-07-2002, 12:36 AM
Hi,
are u using VC++... if so then do #include<glut.h> directly, coz the .h file is either stored in the folder \include\gl\ of your VC directory or is stored in \include itself.
i think writing #include<glut.h> will solve ur problem
Richa

Hobbes7714
10-07-2002, 08:05 AM
I do know the basics, I've been programming for a while and have already used SDL graphics. The math.h did not come with my compilier, or rather it did, but another one came with my OpenGL book, with a comment at the top that said there some things that the normal math.h did not include. I did include windows.h first.

Does that mean that on VC++ 6.0, the statment #include <gl/glut.h> is not allowed, or am I mis-understandind you?

Hobbes http://www.opengl.org/discussion_boards/ubb/smile.gif

*Aaron*
10-07-2002, 03:03 PM
Finnaly, I have to write the normal #include <gl/glut.h> as #include <gl.h> #include <glut.h> because the compilier "Cannot open include file: 'gl/glut.h'" and I'm not sure what to do about that. From your post, it sounds like you think #include <gl/glut.h> means to include a file called gl.h and another called glut.h. Am I correct? What this really means, is to include the file glut.h located in the subdirectory gl in your compiler's include directory or on the include path. A forward slash is the proper way to include files in subdirectories and I have done this without problems on VC++ 6. Search for the file glut.h. If it is located in the include directory, make subdirectory named GL and move it there. This is where it belongs. Also, you should use the gl.h glu.h and glut.h that came with your compiler rather than the ones on the CD. There may be subtle differences that are causing these errors.


Ohh, the errors that I've beeng etting for the math.h change, the last time I tried to compile it, I only got one error, which was: "error C2065: 'floor' : undeclared identifier."Where exactly are these errors occurring--in math.h or a .c* file? I can't imagine the compiler giving you an undeclared identifier error in a header file.

The VC++ compiler does not conform exactly to the C++ specification. For example the perfectly acceptable code:

for(int i=0; i<10; i++);
for(int i=0; i<10; i++); will generate an error like "redeclaration of variable 'i'". These "errors" are not really related to OpenGL, and you can't expect someone else to debug 94 errors for you, can you? You're just going to have to iron these out one by one.