Who knew the super bible was so hard to use

ok i just strted reading the book and i made it to c.2 where it shows you the “simple” program. i downloaded the source code and when i try to compile it in visual studio 2010 ultimate i get the error
1>LINK : fatal error LNK1104: cannot open file ‘freeglut_static.lib’

i have googled this error and i could never find anything that works.
PLEASE HELP!! I REALLY WANT TO LEARN HOW TO USE OPENGL!!!

You have to download and compile freeglut.
http://freeglut.sourceforge.net/

ok no i get the errors…
1>c:\program files\microsoft visual studio 10.0\vc\include\gl\freeglut_std.h(610): error C2065: ‘exit’ : undeclared identifier
1>c:\program files\microsoft visual studio 10.0\vc\include\gl\freeglut_std.h(612): error C2065: ‘exit’ : undeclared identifier
1>c:\program files\microsoft visual studio 10.0\vc\include\gl\freeglut_std.h(614): error C2065: ‘exit’ : undeclared identifier
1>c:\shared\glee.h(42): fatal error C1189: #error : gl.h included before glee.h

heres my code

// Simple.cpp
// The Simplest OpenGL program with GLUT
// OpenGL SuperBible, 3rd Edition
// Richard S. Wright Jr.
// rwright@starstonesoftware.com

#include <gl\freeglut.h>
#include “C:\shared\gltools.h” // OpenGL toolkit

///////////////////////////////////////////////////////////
// Called to draw scene
void RenderScene(void)
{
// Clear the window with current clearing color
glClear(GL_COLOR_BUFFER_BIT);

// Flush drawing commands
glFlush();
}

///////////////////////////////////////////////////////////
// Setup the rendering state
void SetupRC(void)
{
glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
}

///////////////////////////////////////////////////////////
// Main program entry point
int main(int argc, char* argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGBA);
glutCreateWindow(“Simple”);
glutDisplayFunc(RenderScene);

SetupRC();

glutMainLoop();

return 0;
}

seems ur including glut twice…freeglut and gltools i assume refer to the same libraries…the error is because including freeglut includes gl and glu libs…when u include C:\shared\gltools.h … it re-including the gl and glu libs which doesnt sit well with the compiler…

not sure thats the problem though since i havent tried the code

hope it helps

Raza

hey Raza thanks for the idea but if i take out freeglut.h i get my original error and when i take out gltools, i get the error about ‘exit is an undeclared identifier.’

i hope someone could shed anymore light on this because i am completely stuck and i havnt even barely started.

THANKS

EDIT: i got my source code here http://www.opengl.org/sdk/docs/books/SuperBible/

include these headers:
#include <stdio.h>
#include <stdlib.h>

1>c:\shared\glee.h(42): fatal error C1189: #error : gl.h included before glee.h

Have you verified the where glee.h and gl.h are included ? I have a feeling gltools is including glee.h.

You have to know freeglut includes both gl.h and glu.h. Obviously glee.h needs to be included first so you have to verify where it is and make sure its included first.

Have you tried including gltools before freeglut ?

Ok, forget about my last post, I downloaded the source code of the super bible and tried it, and I was left with the same problem, that is missing the freeglut lib reference.

Now the thing I really find stupid is that since its a complete solution and all they should have put the lib in there so beginners do not have to worry about these kinds of things. Maybe its because of rights to distrubute or something but anyway.

Here is whta you have to do : download the freeglut source code (I think you already did that).

Now you DO NOT include freeglut.h since the gltools.h is already doing that for you. What you want is the .lib of freeglut. So basically, build freeglut in Release configuration and go in the release folder after that. You should find a freeglut_static.lib in there.

Copy freeglut_static.lib and paste it at the root of the solution file you wish to test.

I did exactly that and made the example of chapter 2 (simple) work.

I know, a lot of book assume you know this kinda stuff and it’s frustrating. Anyway hope it helped !

Mick

I LOVE YOU MICK!!! THANKS SO MUCH!!! IT WORKS PERFECTLY!!!

You’re welcome !