PDA

View Full Version : Who knew the super bible was so hard to use



ryanppax
04-21-2010, 08:53 PM
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!!!!

randall
04-22-2010, 01:01 AM
You have to download and compile freeglut.
http://freeglut.sourceforge.net/

ryanppax
04-22-2010, 01:41 PM
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

ryanppax
04-22-2010, 01:42 PM
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(&amp;argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGBA);
glutCreateWindow("Simple");
glutDisplayFunc(RenderScene);

SetupRC();

glutMainLoop();

return 0;
}

badass
04-22-2010, 04:40 PM
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

ryanppax
04-22-2010, 09:17 PM
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/

randall
04-23-2010, 01:28 AM
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



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

FrimaMichael
04-23-2010, 08:12 AM
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 ?

FrimaMichael
04-23-2010, 09:24 AM
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

ryanppax
04-23-2010, 01:29 PM
I LOVE YOU MICK!!!!! THANKS SO MUCH!!!!! IT WORKS PERFECTLY!!!

FrimaMichael
04-23-2010, 01:50 PM
You're welcome !