PDA

View Full Version : Hi to everyone :-)



Enchantress
05-07-2003, 01:12 PM
Hi,
I am new to OpenGL, so may be my question will sound as dumb as it's possible :-)

I am trying to work with OpenGL in C++ environment, however it keeps telling me about every command: undefined reference to `name of the command`
I added the files gl.h, glu.h and glut.h to the lib directory, and included the in the begining of the file, but it still doesn't work http://www.opengl.org/discussion_boards/ubb/frown.gif
what am I doing wrong???

Thank you very much,
Enchantress.

[This message has been edited by Enchantress (edited 05-07-2003).]

JanHH
05-07-2003, 02:31 PM
a) you do not have to add these files to the lib, but to the include directory

b) you have to link the opengl libraries to your application, how this is done depends on the operation system and the c++ development enviroment you are using.

nexusone
05-07-2003, 04:47 PM
First when you ask about a compiler problem please include the name and version of the compiler that you are using and operating system.


files with the .h go into the include, to be specific:

directory:
include/GL/
gl.h
glu.h
glut.h

lib/
opengl32.lib // microsoft VC++ and borland
glu32.lib
glut32.lib
// gcc and dev-c in windows
libopengl32.a
libglu32.a
libglut32.a
// linux gcc
libGL.a
libGLU.a
libglut.a


Also need to include in the linker settings, for the compiler to include needed library when compiling, on windows would look something like this:
opengl32.lib glu32.lib and if glut commands are used then glut32.lib


Originally posted by Enchantress:
Hi,
I am new to OpenGL, so may be my question will sound as dumb as it's possible :-)

I am trying to work with OpenGL in C++ environment, however it keeps telling me about every command: undefined reference to `name of the command`
I added the files gl.h, glu.h and glut.h to the lib directory, and included the in the begining of the file, but it still doesn't work http://www.opengl.org/discussion_boards/ubb/frown.gif
what am I doing wrong???

Thank you very much,
Enchantress.

[This message has been edited by Enchantress (edited 05-07-2003).]

Enchantress
05-07-2003, 05:59 PM
Thank you sooo much :-)

another question: what does it mean "linker"? How do I do it? Should it be in options of the compiler or is it also kind of #include 's?

shinpaughp
05-07-2003, 07:11 PM
The linker uses the object files generated by the compiler to create the binary/executable. If you want to know how or where to "do it", please tell us which compiler you are using...

nexusone
05-08-2003, 04:35 AM
The linker settings are little diffrent for each compiler, you did not answer what compiler you are using or what operating system?

Maybe you should take a little time to read you documentation for your compiler!!!
Also learn about C/C++!

First you must understand that your computer can not run any program until it has been translated into the computers language.
Computers speak a very hard and criptic language. That is why laguages like C/C++, basic, etc where written, so that people could write in a english style lanuage.
But at the same time structure in a way that it could be easly translated into a form that could be turn into a computers language.

You compiler does few things before it translates it to the computer language.

First is does something like a spelling and grammer check.

The .h or include files tells the compiler what set's of commands or routines to include in the program. gl.h tells the computer that base openGL commands will be used.

Now after the computer has proofed the program it goes into the linker part.
The linking checks to see if you have the commands that you have place in your program.
The command library's are located in the lib directory.

In the case of opengl on windows and under MS VC++ is it called opengl32.lib

After linking the program the compiler creates a .exe file if there has been no erros.


Originally posted by Enchantress:
Thank you sooo much :-)

another question: what does it mean "linker"? How do I do it? Should it be in options of the compiler or is it also kind of #include 's?