PDA

View Full Version : OpenGL DevC++ set up problems



Wavesonics
07-27-2004, 08:44 PM
I'm trying to learn Open GL and bought a book but of course the book is written for VC++ and I use Dev C++ b/c im not rich.

So I finaly got all the files I need and I get this compile error:

1 C:\Dev-Cpp\my code\openGL\my code\Chapter01\Simple.cpp
In file included from C:/Dev-Cpp/my code/openGL/my code/Chapter01/Simple.cpp

50 C:\Dev-Cpp\include\GL\glut.h
redeclaration of C++ built-in type `wchar_t'

I have spent such copious amounts of time on the f*ing problem some help would really REALLY be appreciated.

Wavesonics
07-27-2004, 09:22 PM
UPDATE:
I commented out line 50 and that error goes away.

But then I get 10 million link errors :(
example:

[Linker error] undefined reference to `__glutInitWithExit'

wtf why does the opengl god hate me so...

07-27-2004, 09:38 PM
check out http://nehe.gamedev.net/

they have setups for most of the build environments for each tutorial.

Wavesonics
07-27-2004, 10:04 PM
Ok 1 of the projects from that site actualy compiles, but my sample code (from an opengl book i bought) that use the same Linking parameters and same include still doesnt work. Gives me linking errors! WTF!!! what am I doing wrong?!

07-27-2004, 10:12 PM
what book did you get?

anyway, im not familiar with devc, but i would carefully compare all the compiler options with the project that works against the project that doesnt. surely theres a simple descrepency somewhere. if you have a project that works, youre almost there!

Wavesonics
07-27-2004, 10:21 PM
I got:
"Beginning OpenGL Game Programming"
I've check all the options over and over the ONLY thing he has set w\ the project settings are the linkers and I copied those exactly to the global linker settings. I also deleted all his code and copied in the books sample code right into the project and still get the linker errors. Idk... I just am at a total lose for wtf is going on w\ this damn thing.

Wavesonics
07-27-2004, 10:25 PM
I just compile a file with:

#include <GL/glut.h>

thats it and i still get 3 errors... Heres the full compile log:

Compiler: Default compiler
Executing g++.exe...
g++.exe "C:\Dev-Cpp\my code\openGL\my code\test\stupid.cpp" -o "C:\Dev-Cpp\my code\openGL\my code\test\stupid.exe" -I"C:\Dev-Cpp\include\c++" -I"C:\Dev-Cpp\include\c++\mingw32" -I"C:\Dev-Cpp\include\c++\backward" -I"C:\Dev-Cpp\include" -I"C:\Dev-Cpp\include\GL" -L"C:\Dev-Cpp\lib" -lopengl32 -lglu32 -lglut32
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccK0baaa.o(.text+0x15):stupid.cpp: undefined reference to `__glutInitWithExit'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccK0baaa.o(.text+0x30):stupid.cpp: undefined reference to `__glutCreateWindowWithExit'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccK0baaa.o(.text+0x4c):stupid.cpp: undefined reference to `__glutCreateMenuWithExit'
C:\Dev-Cpp\lib/libmingw32.a(main.o)(.text+0x7f):main.c: undefined reference to `WinMain@16'

Execution terminated

Wavesonics
07-27-2004, 10:30 PM
Just realized why that 1 project worked.

It's not using Glut. only gl and glu... feck feck feck FEEECCKK!!!

07-27-2004, 10:32 PM
wheres your main? why the reference to WinMain? are you building a console app, or a windows app? for a windows app, you need a WinMain, for a console app you need a main.

example minimal console app:


// dont forget to include windows BEFORE glut!
#include <windows.h>
#include <gl/glut.h>

int main(int argc, char **argv){
return 0;
}

Wavesonics
07-27-2004, 10:38 PM
ya i know the difference, thought I had -mwindows turned off, must have left it on. Doesnt matter either way though. Thats a solvable problem. this is seems is not lol...

Actualy much eariler 2 nite I had a glut template program (DevC++ genereates templates 1 of which is a OpenGL window) compiling and now i generate that template and I get the same errors... i need to reset my ****ing headers and libs and dlls...

Wavesonics
07-27-2004, 10:53 PM
oo... ssoo... close...

Ok switched to using the "freeglut.h" and stuff and it solved everything, but this:

76 C:\Dev-Cpp\my code\openGL\my code\template\main.cpp
`exit' undeclared (first use this function)

Wavesonics
07-27-2004, 10:59 PM
I do a compile of just:

#include <GL/freeglut.h>

and get the following error:

cannot find -llibfreeglut

WTF!!!! i know its there im looking at the damn thing!

Wavesonics
07-27-2004, 11:14 PM
O M F G AHAHAHAHAH YYYEEESSSS AHAHAHAHAH I DID IT THANK U ALL THANK U SO F*ING MUCH!!!!!!!!!!

In dev c++ the actual lib name is "libfreeglut.a" or what ever but it's prefaced with "lib" which u do NOT INCLUDE in the command line linker!! AHAHAH YYEESSSS!!!!!!!!!! 04:13 lets see i started this at what... 21:00 last nite? oohhh ya...

Well my Open GL learning can commence after some HALO fragging thank you all so dearly for helping me through this you guys rock!

Wavesonics
07-27-2004, 11:26 PM
well i got the templates compiling fine but the ****ing sample code from the book is still ****ed.... jesus christ it just never ends...

Well this time all the Linking errors are for gl and glu... atleast glut is fixed it seems.

Any ideas on where to get good versionf of the gl and glu headers and libs?

07-27-2004, 11:39 PM
congrats on the partial success!

you can get the latest extension headers (glext.h and wglext.h) here
http://oss.sgi.com/projects/ogl-sample/registry/

gl.h, glu.h, and libs should come with the devcpp distribution, i would think. you think theyre bad? what kind of errors are you getting?

the dlls come with windows and your video drivers. just upgrade to the latest drivers from your cards web site (nvidia,ati,...).

Wavesonics
07-27-2004, 11:41 PM
Well I downloaded a VC++ 2005 beta and compiled the sample code in there and it works (2 warnings but... it works.) I really don't like VC++ its huge, tons more to learn if I'm gonna use it for this entire open gl book.

But it works... I think I'm gonna call it a nite... get some sleep b4 i continue... thanks fo your help everyone.

Wavesonics
07-27-2004, 11:45 PM
I'm getting more linking errors:


[Linker error] undefined reference to `glGetString@4'

Like that... but its prefaced with gl and some times glu not glut so thats why I think maybe some header and lib files aren't matching up what with all the changing of headers and libs i've done to nite.

But I can't for the life of me ever find just gl and glu headers and libs b/c like u said they always come w\ the compiler.

Reinstall my compiler and get fresh headers and libs maybe? Hopefully I wont lose the other packages I've installed.

ZbuffeR
07-28-2004, 07:07 AM
Check how you specify your libs, for opengl it can be :
GL, gl, opengl, or opengl32

depending on the compiler/OS etc. You may search in the lib directory of your compiler for a correct name (libopengl32.a , or whatever)

Wavesonics
07-28-2004, 10:39 AM
ya i know the libs names and I know their there but I think maybe the header file is from a different build then the lib file thus is making calls to stuff that isnt in the lib file. Idk I'm gonna reinstall my compiler to get al the originals lets hope it works.

Wavesonics
07-28-2004, 10:47 AM
Ok I reinstalled my compiler's headers and libs and recompiled and still get my errors... Heres the log:

Compiler: Default compiler
Executing g++.exe...
g++.exe "C:\Dev-Cpp\my code\openGL\my code\Chapter01\Simple.cpp" -o "C:\Dev-Cpp\my code\openGL\my code\Chapter01\Simple.exe" -mwindows -I"C:\Dev-Cpp\include\c++" -I"C:\Dev-Cpp\include\c++\mingw32" -I"C:\Dev-Cpp\include\c++\backward" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib" -lopengl32 -lglu32 -lglut32
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x18f):Simple.cpp: undefined reference to `_imp__glEnable'

C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x22d):Simple.cpp: undefined reference to `_imp__glViewport'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x23f):Simple.cpp: undefined reference to `_imp__glMatrixMode'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x249):Simple.cpp: undefined reference to `_imp__glLoadIdentity'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x27d):Simple.cpp: undefined reference to `_imp__gluPerspective'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x28f):Simple.cpp: undefined reference to `_imp__glMatrixMode'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x2a1):Simple.cpp: undefined reference to `_imp__glLoadIdentity'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x2d8):Simple.cpp: undefined reference to `_imp__gluLookAt'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x2ea):Simple.cpp: undefined reference to `_imp__glClear'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x2f9):Simple.cpp: undefined reference to `_imp__glBegin'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x30f):Simple.cpp: undefined reference to `_imp__glColor3f'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x32b):Simple.cpp: undefined reference to `_imp__glVertex3f'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x341):Simple.cpp: undefined reference to `_imp__glColor3f'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x35d):Simple.cpp: undefined reference to `_imp__glVertex3f'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x373):Simple.cpp: undefined reference to `_imp__glColor3f'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x38c):Simple.cpp: undefined reference to `_imp__glVertex3f'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x396):Simple.cpp: undefined reference to `_imp__glEnd'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x3a2):Simple.cpp: undefined reference to `_imp__glBegin'

C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x3be):Simple.cpp: undefined reference to `_imp__glColor3f'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x3d7):Simple.cpp: undefined reference to `_imp__glVertex3f'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x3f0):Simple.cpp: undefined reference to `_imp__glColor3f'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x409):Simple.cpp: undefined reference to `_imp__glVertex3f'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x422):Simple.cpp: undefined reference to `_imp__glColor3f'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x43b):Simple.cpp: undefined reference to `_imp__glVertex3f'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x44e):Simple.cpp: undefined reference to `_imp__glColor3f'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x467):Simple.cpp: undefined reference to `_imp__glVertex3f'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x480):Simple.cpp: undefined reference to `_imp__glColor3f'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x499):Simple.cpp: undefined reference to `_imp__glVertex3f'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x4a3):Simple.cpp: undefined reference to `_imp__glEnd'
C:\Dev-Cpp\lib/libglut32.a(glut_swap.o)(.text+0x71):glut_swap.c: undefined reference to `wglSwapBuffers@4'
C:\Dev-Cpp\lib/libglut32.a(glut_event.o)(.text+0x319):glut_event. c: undefined reference to `glFinish@0'
C:\Dev-Cpp\lib/libglut32.a(glut_event.o)(.text+0x374):glut_event. c: undefined reference to `wglSwapBuffers@4'

C:\Dev-Cpp\lib/libglut32.a(glut_event.o)(.text+0x3dc):glut_event. c: undefined reference to `wglSwapBuffers@4'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x18f):glut_win.c: undefined reference to `wglGetCurrentContext@0'

C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x196):glut_win.c: undefined reference to `wglGetCurrentDC@0'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x1b6):glut_win.c: undefined reference to `wglMakeCurrent@8'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x1d5):glut_win.c: undefined reference to `glViewport@16'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x1f7):glut_win.c: undefined reference to `wglMakeCurrent@8'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x216):glut_win.c: undefined reference to `glViewport@16'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x21e):glut_win.c: undefined reference to `wglGetCurrentContext@0'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x225):glut_win.c: undefined reference to `wglGetCurrentDC@0'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x241):glut_win.c: undefined reference to `wglMakeCurrent@8'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x843):glut_win.c: undefined reference to `wglGetCurrentContext@0'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x84a):glut_win.c: undefined reference to `wglGetCurrentDC@0'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x866):glut_win.c: undefined reference to `wglMakeCurrent@8'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x897):glut_win.c: undefined reference to `glDrawBuffer@4'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x8a6):glut_win.c: undefined reference to `glReadBuffer@4'

C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0xaa1):glut_win.c: undefined reference to `wglDeleteContext@4'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0xb61):glut_win.c: undefined reference to `wglMakeCurrent@8'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0xbd2):glut_win.c: undefined reference to `wglGetCurrentContext@0'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0xbd9):glut_win.c: undefined reference to `wglGetCurrentDC@0'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0xbf5):glut_win.c: undefined reference to `wglMakeCurrent@8'

C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0xcb4):glut_win.c: undefined reference to `wglGetCurrentContext@0'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0xcbb):glut_win.c: undefined reference to `wglGetCurrentDC@0'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0xcd7):glut_win.c: undefined reference to `wglMakeCurrent@8'
C:\Dev-Cpp\lib/libglut32.a(glut_mesa.o)(.text+0x80):glut_mesa.c: undefined reference to `glGetString@4'
C:\Dev-Cpp\lib/libglut32.a(glut_mesa.o)(.text+0x91):glut_mesa.c: undefined reference to `glGetString@4'
C:\Dev-Cpp\lib/libglut32.a(glut_util.o)(.text+0x281):glut_util.c: undefined reference to `glGetError@0'
C:\Dev-Cpp\lib/libglut32.a(glut_util.o)(.text+0x28d):glut_util.c: undefined reference to `gluErrorString@4'

C:\Dev-Cpp\lib/libglut32.a(win32_glx.o)(.text+0x30d):win32_glx.c: undefined reference to `wglCreateContext@4'
C:\Dev-Cpp\lib/libglut32.a(win32_winproc.o)(.text+0x292):win32_wi nproc.c: undefined reference to `joyReleaseCapture@4'
C:\Dev-Cpp\lib/libglut32.a(win32_winproc.o)(.text+0x3fc):win32_wi nproc.c: undefined reference to `joySetCapture@16'
C:\Dev-Cpp\lib/libglut32.a(win32_winproc.o)(.text+0x162f):win32_w inproc.c: undefined reference to `joyGetPosEx@8'
C:\Dev-Cpp\lib/libglut32.a(win32_winproc.o)(.text+0x171f):win32_w inproc.c: undefined reference to `joyGetPosEx@8'

Execution terminated

Any ideas? any one?

Wavesonics
07-28-2004, 11:05 AM
I've got a few options here...
For headers I have:
glut.h
freeglut.h

These are the ones I have been working with.
Then I have these libs:

libglut.a
libglut32.a
libfreeglut.a

When I include freeglut.h and link to libfreeglut.a I get the fewest linking errors.

Now I also have several header files that give me wierd syntax errors:

fglut.h
freeglut_std.h
freeglut_ext.h
glutf90.h

All these just give me strange errors.

Well any way with calling freeglut.h and linking to: -lopengl32 -lglu32 -lfreeglut

I get this compile log. Much shorter but... Still no moss...

Compiler: Default compiler
Executing g++.exe...
g++.exe "C:\Dev-Cpp\my code\openGL\my code\Chapter01\Simple.cpp" -o "C:\Dev-Cpp\my code\openGL\my code\Chapter01\Simple.exe" -mwindows -I"C:\Dev-Cpp\include\c++" -I"C:\Dev-Cpp\include\c++\mingw32" -I"C:\Dev-Cpp\include\c++\backward" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib" -lopengl32 -lglu32 -lfreeglut
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0x3b):Simple.cpp: undefined reference to `_imp__glutInit@8'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0x4a):Simple.cpp: undefined reference to `_imp__glutInitDisplayMode@4'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0x61):Simple.cpp: undefined reference to `_imp__glutInitWindowSize@8'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0x75):Simple.cpp: undefined reference to `_imp__glutInitWindowPosition@8'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0x87):Simple.cpp: undefined reference to `_imp__glutCreateWindow@4'

C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0x9e):Simple.cpp: undefined reference to `_imp__glutDisplayFunc@4'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0xb0):Simple.cpp: undefined reference to `_imp__glutReshapeFunc@4'

C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0xc2):Simple.cpp: undefined reference to `_imp__glutMouseFunc@4'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0xd4):Simple.cpp: undefined reference to `_imp__glutKeyboardFunc@4'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0xe6):Simple.cpp: undefined reference to `_imp__glutIdleFunc@4'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0xf0):Simple.cpp: undefined reference to `_imp__glutMainLoop@0'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0x111):Simple.cpp: undefined reference to `_imp__glutCreateMenu@4'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0x124):Simple.cpp: undefined reference to `_imp__glutSetMenu@4'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0x138):Simple.cpp: undefined reference to `_imp__glutAddMenuEntry@8'

C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0x147):Simple.cpp: undefined reference to `_imp__glutAttachMenu@4'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0x17c):Simple.cpp: undefined reference to `_imp__glutPostRedisplay@0'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0x1aa):Simple.cpp: undefined reference to `_imp__glutPostRedisplay@0'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0x1cc):Simple.cpp: undefined reference to `_imp__glutPostRedisplay@0'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0x1db):Simple.cpp: undefined reference to `_imp__glutPostRedisplay@0'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0x43c):Simple.cpp: undefined reference to `_imp__glutSwapBuffers@0'

Execution terminated

Wavesonics
07-28-2004, 11:45 AM
OMFG!!! BREAK THROUGH!!! look look look!!!

If I link:
-lopengl32 -lglu32 -lfreeglut -lglut

Notice -lfreeglut AND -lglut THEN IT COMPILES!!!! Only problem is just glut is a older file and it wants opengl.dll to run my finaly exe and I only have opengl32.dll... So i'm looking for opengl.dll if any one has it or knows where I can get it please tell me.

Wavesonics
07-28-2004, 11:57 AM
Nope nope nope...

Well I got the dll i needed then it needed another dll and another and another and it just went on and on till finaly it gave me some error about my entry point... So f* it just f* it...

Here's what I'm gonna do. I'll post the source of the file I'm trying to compile and if any one has it in their heart to see if they can compile it, and they do and it works. Tell me how lol...

I still am calling the freeglut header, change it to what ever glut you have. Also I'm calling the std lib b/c with out it I get an error calling the exit(); function but this include wansn't in the original code so feel free to take it out. Besides that it's all exactly the same as what was in the book (strait from the book's CD actualy)


#include <gl\freeglut.h>
#include <cstdlib>

void Initialize();
void MouseHandler(int button, int state, int x, int y);
void KeyboardHandler(unsigned char key, int x, int y);
void MainMenuHandler(int option);
void Animate();
void Reshape(int width, int height);
void Display();

/************************************************** **************************
main()

Setup GLUT and OpenGL, drop into the event loop
************************************************** ***************************/
int main(int argc, char **argv)
{
// Setup the basic GLUT stuff
glutInit(&amp;argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);

// Create the window
glutInitWindowSize(1024, 768);
glutInitWindowPosition(100, 150);
glutCreateWindow("BOGLGP Chapter 1");

Initialize();

// Register the event callback functions
glutDisplayFunc(Display);
glutReshapeFunc(Reshape);
glutMouseFunc(MouseHandler);
glutKeyboardFunc(KeyboardHandler);
glutIdleFunc(Animate);

// At this point, control is relinquished to the GLUT event handler.
// Control is returned as events occur, via the callback functions.
glutMainLoop();

return 0;
} // end main()


/************************************************** **************************
Initialize()

One time setup, including creating menus, creating a light, setting the
shading mode and clear color, and loading textures.
************************************************** ***************************/
void Initialize()
{
// set up the only meny
int mainMenu;

mainMenu = glutCreateMenu(MainMenuHandler);

glutSetMenu(mainMenu);
glutAddMenuEntry("Exit", 0);
glutAttachMenu(GLUT_RIGHT_BUTTON);

glEnable(GL_DEPTH_TEST);
} // end Initialize()


/************************************************** **************************
MouseHandler()

Handle mouse events. For this simple demo, just exit on a left click.
************************************************** ***************************/
void MouseHandler(int button, int state, int x, int y)
{
switch (button)
{
case GLUT_LEFT_BUTTON:
{
exit(0);
} break;
default:
break;
}

// force a screen redraw
glutPostRedisplay();
} // end MouseHandler()


/************************************************** **************************
KeyboardHandler()

Keyboard handler. Again, we'll just exit when q is pressed.
************************************************** ***************************/
void KeyboardHandler(unsigned char key, int x, int y)
{
switch (key)
{
case 'q': // exit
{
exit(0);
} break;
default:
{
} break;
}
glutPostRedisplay();
} // end KeyboardHandler()


/************************************************** **************************
MainMenuHandler()

Main menu callback.
************************************************** ***************************/
void MainMenuHandler(int option)
{
switch(option)
{
case 0:
{
exit(0);
} break;
default:
break;
}
glutPostRedisplay();
} // end MainMenuHandler()


/************************************************** **************************
Animate()

Rotate the cube by 4 degrees and force a redisplay.
************************************************** ***************************/
void Animate()
{
glutPostRedisplay();
} // end Animate()


/************************************************** **************************
Reshape()

Reset the viewport for window changes
************************************************** ***************************/
void Reshape(int width, int height)
{
if (height == 0)
return;

glViewport(0, 0, (GLsizei) width, (GLsizei) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(90.0, width/height, 1.0, 100.0);

glMatrixMode(GL_MODELVIEW);
} // end Reshape


/************************************************** **************************
Display()

Clear and redraw the scene.
************************************************** ***************************/
void Display()
{
// set up the camera
glLoadIdentity();
gluLookAt(0.0, 1.0, 6.0,
0.0, 0.0, 0.0,
0.0, 1.0, 0.0);

// clear the screen
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

// draw a triangle
glBegin(GL_TRIANGLES);
glColor3f(1.0, 0.0, 0.0);
glVertex3f(2.0, 2.5, -1.0);
glColor3f(0.0, 1.0, 0.0);
glVertex3f(-3.5, -2.5, -1.0);
glColor3f(0.0, 0.0, 1.0);
glVertex3f(2.0, -4.0, 0.0);
glEnd();

// draw a polygon
glBegin(GL_POLYGON);
glColor3f(1.0, 1.0, 1.0);
glVertex3f(-1.0, 2.0, 0.0);
glColor3f(1.0, 1.0, 0.0);
glVertex3f(-3.0, -0.5, 0.0);
glColor3f(0.0, 1.0, 1.0);
glVertex3f(-1.5, -3.0, 0.0);
glColor3f(0.0, 0.0, 0.0);
glVertex3f(1.0, -2.0, 0.0);
glColor3f(1.0, 0.0, 1.0);
glVertex3f(1.0, 1.0, 0.0);
glEnd();

// draw everything and swap the display buffer
glutSwapBuffers();
} // end Display()

Me6
08-02-2004, 04:27 AM
I use Dev-CPP to compile my GL programs, and I was forever not being able to compile any program, until I used this as my linker line:

-lopengl32 -lglu32 -lglaux -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32

And this for my compiler:

-D__GNUWIN32__ -W -DWIN32 -DNDEBUG -D_WINDOWS -D_MBCS

SO you should give it a shot

08-02-2004, 07:58 AM
But your not linking glut which is what i needed. And isn't gluax really freaking old and unsupported?

Me6
08-05-2004, 06:23 AM
well, you could use that linker and add -glut32 , and yes the GLAuxilary LIB. is really old and has alot of errors , but still some example code out there still uses GLaux, so i figure that it is best to keep it in there. I noticed that in your code that you posted that in your inludes you only included

#include <gl\freeglut.h>
#include <cstdlib>you should try this line:


#include <windows.h> // Header File For Windows
#include <gl\gl.h> // Header File For The OpenGL32 Library
#include <gl\glu.h> // Header File For The GLu32 Library
#include <gl\glaux.h> // Header File For The Glaux Library
#include <gl\freeglut.h>
#include <cstdlib>only use the windows.h in you are developing on windows, (obviously), and I know that there is the GLAUX.h header file in there but it is for the best. Hope I helped....

Me6
08-05-2004, 06:35 AM
I have downloaded your source code and all that apply and I have put in all the things that I suggested and I get 1 error:

Compiler: Default compiler
Building Makefile: "C:\Dev-Cpp\Makefile.win"
Finding dependencies for file: C:\Dev-Cpp\WavesCode.cpp
Executing make...
make.exe -f "C:\Dev-Cpp\Makefile.win" all
make.exe: *** No rule to make target `d', needed by `WavesCode.o'. Stop.

Execution terminated

tell me if you want the files

Me6
08-05-2004, 11:19 AM
(sorry about the triple post)

I updated my Dev-CPP Version (to version 4.9.9.0, just released in july) and here is what the compiler said:


Compiler: Default compiler
Building Makefile: "C:\Dev-Cpp\Makefile.win"
Finding dependencies for file: C:\Dev-Cpp\b.cpp
Executing make...
make.exe -f "C:\Dev-Cpp\Makefile.win" all
g++.exe -c b.cpp -o b.o -I"C:/Dev-Cpp/include/c++" -I"C:/Dev-Cpp/include/c++/mingw32" -I"C:/Dev-Cpp/include/c++/backward" -I"C:/Dev-Cpp/include"

b.cpp:4:2: invalid preprocessing directive #inclue

make.exe: *** [b.o] Error 1

Execution terminated

ZbuffeR
08-06-2004, 02:24 AM
>> b.cpp:4:2: invalid preprocessing directive #inclue

yeah, #inclue does not exists, it is #include ...

Anyway, nexusone has a good page on DEV C++ setup :
http://www.angelfire.com/linux/nexusone/dev4.html

He is frequently around this board normally, but I have seem him for quite some time.

Me6
08-06-2004, 10:10 AM
Yes ZBuffer, I realized that last night, but thanks anyways. once I fixed that it has a problem with the makefile.win:


Compiler: Default compiler
Building Makefile: "C:\Dev-Cpp\Makefile.win"
Finding dependencies for file: C:\Dev-Cpp\b.cpp
Executing make...
make.exe -f "C:\Dev-Cpp\Makefile.win" all
C:\Dev-Cpp\Makefile.win:28: *** multiple target patterns. Stop.

Execution terminatedany ideas what this means?

Me6
08-06-2004, 10:21 AM
YES!! I got it to compile and run!! Although, I am not sure if it does what it is supposed to do.