PDA

View Full Version : please help



Swiftwing
10-11-2002, 02:19 PM
I have coppied the following code from a book:
#include <gl/glut.h>

int main(int argc, char **argv) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_SINGLE | GLUT_RGBA);
glutInitWindowPosition(100,100);
glutInitWindowSize(320,320);
glutCreateWindow("3D Tech- GLUT Tutorial");

}

It compiles nicely but when I try to link it I get the following errors:

C:\MinGW\bin>g++ -o test test.o
test.o(.text+0x15):test.cpp: undefined reference to `__glutInitWithExit@12'
test.o(.text+0x32):test.cpp: undefined reference to `__glutCreateWindowWithExit@
8'
test.o(.text+0x50):test.cpp: undefined reference to `__glutCreateMenuWithExit@8'

test.o(.text+0xa8):test.cpp: undefined reference to `glutInitDisplayMode@4'
test.o(.text+0xb7):test.cpp: undefined reference to `glutInitWindowPosition@8'
test.o(.text+0xcc):test.cpp: undefined reference to `glutInitWindowSize@8'

What am I doing wrong?
- can it have something to do with me not having the .dll files: opengl32 and gl32? (I have the glut32.dll)
- and if so where do I get them.


thanks

nexusone
10-11-2002, 02:32 PM
Try downloading the windows GLUT lib's .h, and dll files from here:
http://www.xmission.com/~nate/opengl.html



Originally posted by Swiftwing:
I have coppied the following code from a book:
#include <gl/glut.h>

int main(int argc, char **argv) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_SINGLE | GLUT_RGBA);
glutInitWindowPosition(100,100);
glutInitWindowSize(320,320);
glutCreateWindow("3D Tech- GLUT Tutorial");

}

It compiles nicely but when I try to link it I get the following errors:

C:\MinGW\bin>g++ -o test test.o
test.o(.text+0x15):test.cpp: undefined reference to `__glutInitWithExit@12'
test.o(.text+0x32):test.cpp: undefined reference to `__glutCreateWindowWithExit@
8'
test.o(.text+0x50):test.cpp: undefined reference to `__glutCreateMenuWithExit@8'

test.o(.text+0xa8):test.cpp: undefined reference to `glutInitDisplayMode@4'
test.o(.text+0xb7):test.cpp: undefined reference to `glutInitWindowPosition@8'
test.o(.text+0xcc):test.cpp: undefined reference to `glutInitWindowSize@8'

What am I doing wrong?
- can it have something to do with me not having the .dll files: opengl32 and gl32? (I have the glut32.dll)
- and if so where do I get them.


thanks

Swiftwing
10-11-2002, 03:14 PM
thanks - but I allready did that!


Originally posted by nexusone:
Try downloading the windows GLUT lib's .h, and dll files from here:
http://www.xmission.com/~nate/opengl.html

nexusone
10-11-2002, 05:47 PM
Do you have the "glut32.lib" file included in your linker settings?
The glut32.dll is only called when the program is run.

Do your have the library file that if compatiable with your compiler, the one from nates site is for MSVC++ only. Unless your compiler reads MSVC library files, you will need to convert or find one for your compiler.


Originally posted by Swiftwing:
thanks - but I allready did that!





[This message has been edited by nexusone (edited 10-11-2002).]

Swiftwing
10-13-2002, 10:20 AM
[QUOTE]Originally posted by nexusone:
[B]Do you have the "glut32.lib" file included in your linker settings?

- I really don't know - how do i do that? / how do I check it?

The glut32.dll is only called when the program is run.

- I know - strangly enough...

Do your have the library file that is compatiable with your compiler, the one from nates site is for MSVC++ only.
Unless your compiler reads MSVC library files, you will need to convert or find one for your compiler.

- I havn't converted anything - how do I do that? - I'm using the minGW compiler.



[This message has been edited by Swiftwing (edited 10-13-2002).]

nexusone
10-13-2002, 11:21 AM
If you had downloaded the files from nate robins site you should have also got a file called glut32.lib, which should be put in the /lib/ directory in your compilers directory.

Then you will have to add the glut32.lib to your linker settings if you have not done so already.

The glut32.dll is only needed when the program is run, not during the compiling of the program.


I can not tell you anything about the mingw, other then a lot of people have problems.

Maybe better you try the free compiler I use.... lcc-win32, nice GUI interface, and I have no problems making GLUT programs.

Just do a google search for lcc-win32....



Originally posted by Swiftwing:
[QUOTE]Originally posted by nexusone:
[B]Do you have the "glut32.lib" file included in your linker settings?

- I really don't know - how do i do that? / how do I check it?

The glut32.dll is only called when the program is run.

- I know - strangly enough...

Do your have the library file that is compatiable with your compiler, the one from nates site is for MSVC++ only.
Unless your compiler reads MSVC library files, you will need to convert or find one for your compiler.

- I havn't converted anything - how do I do that? - I'm using the minGW compiler.

[This message has been edited by Swiftwing (edited 10-13-2002).]