PDA

View Full Version : I need help with my first attempt at a c++ prog with opengl...



Y-T
06-07-2000, 06:18 PM
Here's my code:
#include <windows.h>
#include <gl/glut.h>

void RenderScene(void)
{
glClear(GL_COLOR_BUFFER_BIT);

glFlush();
}
void SetupRC(void)
{
glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
}
void main(void)
{
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutCreateWindow("Simple");
glutDisplayFunc(RenderScene);

SetupRC();

glutMainLoop();
}
Here's the error message:
unresolved external '....'

i bought the opengl superbible and it has all the glut files on them.There's no self-extracting archive...
what files do i need to install and where do i install them?

Bob
06-08-2000, 03:38 AM
I can't help you unless you tell me exactly (more or less) what the errormessage is saying. It's pretty obvious that you are missing a library file, but I can't tell which. In the errormessage it should say what function it couldn't find, and from there I (we) might be able to tell what library file is missing. ANd by the way, what platform/compiler are you using?

El Jefe
06-08-2000, 07:12 AM
If you got to Project->Settings from the menu...

Then go to the Link tab..

You may have to add in the OpenGL libs to the Project Options window...right now one of my projects contains things like:

kernel32.lib user32.lib gdi32.lib

So, you may also have to add these into the list of libraries for the link process:

opengl32.lib glu32.lib

Hope that helps!

Bob
06-08-2000, 09:53 AM
Just a note. In MSVC (at least, maybe other compilers too), gl*.lib is included automaticaly from <gl/glut.h>.

In the beginning of the file:



#pragma comment (lib, "winmm.lib") /* link with Windows MultiMedia lib */
#pragma comment (lib, "opengl32.lib") /* link with Microsoft OpenGL lib */
#pragma comment (lib, "glu32.lib") /* link with OpenGL Utility lib */
#pragma comment (lib, "glut32.lib") /* link with Win32 GLUT lib */

Y-T
06-08-2000, 11:13 AM
Thanx alot peeps for your replies!!! I have posted a new message and have included more information. I NEED MENTAL HELP....

Y-T
P.S My washout dye has been in my hair for over a year. maybe if i took a shower once in a while...but i live in canada so it's not my fault the lakes are frozen!!!

Glenn Upton
06-08-2000, 08:14 PM
This is probably stupid and wrong but don't you need to include the gl.h file also? For glFlush, for example. Plus the lakes have all thawed in my part of Canada.

Bob
06-08-2000, 11:21 PM
Can post another part of <gl/glut.h> too.




#include <GL/gl.h>
#include <GL/glu.h>


And if that wasn't enough, since <gl/gl.h> needs <windows.h> (or actually just APIENTRY and WINGDIAPI), it's also included automatically http://www.opengl.org/discussion_boards/ubb/cool.gif

In other words, you only have to include <gl/glut.h>