Public Group

# Getting Started: Beginning OpenGL

This topic is 4423 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I recently bought Astle and Hawkins' Beginning OpenGL Game Programming book, however I am having much trouble getting the Book CD code up and running. While the code in the book was written using VC++ 6.0, I'm trying to use Dev C++, which is what I've used for the NeHe tutorials, and it's much simpler than the new VC++ Express (I can't figure that out for the life of me...). Anyway, I'm trying to run the first program, Simple.cpp, but when I try to compile it says "In file included from Simple.cpp" and it highlights the #include <gl\glut.h> line. I've included this file in DevC++'s include/GL folder, and I'm also linked a good many libraries that were needed to get NeHe's tutorials working. How can I get this program started? Thanks!

##### Share on other sites
None of my BOGLGP code uses glut - why do you have that?

##### Share on other sites
Uh...it's definitely there on the code right off of the CD. The Simple folder from Chapter 1 includes the Simple.cpp and glut.h, in addition to other things. Maybe we have different editions?

##### Share on other sites
Well I'm mostly new to OpenGL as well but I can at least give you a list of all my links and compiler options as I also use Dev-C++.

In the Project Options menu, Parameter tab I have the following:
Compiler:
-D__GNUWIN32__ -W -DWIN32 -DNDEBUG -D_WINDOWS -D_MBCS

C++ Compiler:
<nothing>

-lopengl32 -lglu32 -lglaux -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32

I have no idea what all that crap means all I know is that when I use it I can display graphics. :-P

I don't, however, use glut.h. I have glu.h, gl.h, and glext.h. So I'm probably no help at all. Sorry. I did use NeHe's tutorials to do some basic 3D graphics so I know that at least what I have works on my machine. Got up to lesson 30-something, so if you use what I use you can at least get that far.

If I remember correctly glut.h is old and crappy and I'd recommend not using it. To use NeHe's tuts there's a work around, basically all you have to do is rewrite one of his file loading functions and you're done. I believe the tutorial is even on the NeHe site.

<-- Bad at OpenGL. I'll stick with 2D for now. :-P

Anyway, I've probably only confused but that's all I know. Sorry.

-Artum

##### Share on other sites
No luck yet...when I comment out the glut.h declaration, then the next error coming up is an "undeclared" on the line

glutInit(&argc, argv);

along with a flurry of other errors.

##### Share on other sites

Try enclosing the #include statement in apostrophes #include "..gl\glut.h" or however it goes... If it's in the folder, it should load using this method.

##### Share on other sites
Quote:
 Original post by BenMo... Anyway, I'm trying to run the first program, Simple.cpp, but when I try to compile it says "In file included from Simple.cpp" and it highlights the #include line.

What error is reported? You didn't say what the error is. It is very difficult to suggest a solution without knowing what error was reported.

My guess is that you need to include windows.h before including the gl header files, or maybe you need to include gl.h before glut.h.

##### Share on other sites
Yes, sorry.

When I add in the includes from the NeHe tutorials, stdlib.h, windows.h, stdio.h, gl\gl.h, gl\glu.h, gl\glaux.h, gl\glut.h, then I get a new set of errors...

[Linker error] undefined reference to __glutInitWithExit@12'
[Linker error] undefined reference to __glutCreateWindowWithExit@8'
[Linker error] undefined reference to __glutCreateMenuWithExit@8'
[Linker error] undefined reference to glutInitDisplayMode@4'
[Linker error] undefined reference to `glutInitWindowSize@8'

...etc.

##### Share on other sites
For compilers that do not support "#pragma comment(lib)" you need to add glut32.lib or glut32.a (depending on your compiler) to your linker settings.
Also, glut.h already includes gl.h, glu.h and the like.

Good luck,
Pat.

##### Share on other sites
Only the first example uses Glut. The whole rest of the book uses Win32 which should work fine for you. I would not even worry about it.

PS In this thread, Dave Astle (the author) explains this.

1. 1
2. 2
3. 3
4. 4
frob
15
5. 5

• 16
• 12
• 20
• 12
• 13
• ### Forum Statistics

• Total Topics
632154
• Total Posts
3004472

×