OpenGL DevC++ set up problems

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.

I commented out line 50 and that error goes away.

But then I get 10 million link errors :frowning:

[Linker error] undefined reference to `__glutInitWithExit’

wtf why does the opengl god hate me so…

check out

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

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?!

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!

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.

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 est\stupid.cpp” -o “C:\Dev-Cpp\my code\openGL\my code est\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 toWinMain@16’

Execution terminated

Just realized why that 1 project worked.

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

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;

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…

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 emplate\main.cpp
`exit’ undeclared (first use this function)

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!


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!

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?

congrats on the partial success!

you can get the latest extension headers (glext.h and wglext.h) here

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,…).

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.

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.

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)

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.

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 towglSwapBuffers@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 towglSwapBuffers@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 towglGetCurrentContext@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 towglMakeCurrent@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 towglMakeCurrent@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 towglGetCurrentContext@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 towglMakeCurrent@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 towglGetCurrentDC@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 toglDrawBuffer@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 towglMakeCurrent@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 towglGetCurrentDC@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 towglGetCurrentDC@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 toglGetString@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 toglGetError@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_winproc.c: undefined reference tojoyReleaseCapture@4’
C:\Dev-Cpp\lib/libglut32.a(win32_winproc.o)(.text+0x3fc):win32_winproc.c: undefined reference to joySetCapture@16' C:\Dev-Cpp\lib/libglut32.a(win32_winproc.o)(.text+0x162f):win32_winproc.c: undefined reference tojoyGetPosEx@8’
C:\Dev-Cpp\lib/libglut32.a(win32_winproc.o)(.text+0x171f):win32_winproc.c: undefined reference to `joyGetPosEx@8’

Execution terminated

Any ideas? any one?