PDA

View Full Version : Help on using Dev Cpp on windows 2k with glut and opengl



Jeudy Blanco
01-12-2005, 09:49 AM
Hello, my name is Jeudy Blanco from Costa Rica
I'm just learning opengl on a windows 2000 machine, since I don't have the MS Visual C++ I use Dev Cpp, but when I try to compile the examples from the Red Book of OpenGl the linker sends a lot of errors.
First, I tried to set the Project Options/Linker options with -lglut32 -lopengl32 to include thoose libraries, but this didn't work, so, I included the path of the dlls like this:
c:\winnt\system32\glut32.dll c:\winnt\system32\OPENGL32.dll
and it worked, the program was compiled, but, when I try to run the program, I hav a read access error from windows, and when I debug the program, it says it's a segmentation fault.
I know that a segmentation fault can be thrown by many reasons, but my program is just the Hello World for opengl, so I think there's something wrong with the linking method I use.
Can anybody help me??

Thanks in advance!

mikael_aronsson
01-12-2005, 09:42 PM
Hi !

If your application links without any errors I don't think there is a problem with the linking, could you post the source lines where the error pops up maybe ?

Mikael

CWiC
01-12-2005, 10:35 PM
One should specify library files (*.lib or *.a) but not dll in order to link program. Can't say why you was able to link program with those dll's you specify but can suggest to specify full path to libopengl32.a and libglut32.a files (c:\Dev-Cpp\lib\libopengl32.a and c:\Dev-Cpp\lib\libglut32.a by default).

mikael_aronsson
01-12-2005, 11:43 PM
Hi !

Later versions of the gcc linker can link to a .dll instead of a .a file witout problems, if you want to use the .a files instead this should of course work also, one possibility is that your .a files are in a place where the linker cannot find them, check where the .a files are and put a -Lpath_to_lib_files options before all the -l options and try that.

Mikael

01-13-2005, 08:04 AM
Try leaving out -lopengl32 and -lglu32 in the linker whitespace.

Dont include them as headers either:
#include <gl/gl.h>
#include <gl/glu.h>

Include the following:

#include <stdio.h> // Header File For Standard Input/Output
#include <stdarg.h> // Header File For Variable Argument Routines
#include <math.h> // Header File For Math Stuff
#include <windows.h> // Header File For Windows
#include <gl\glut.h> // Header File For The GLUT Library

....and link to those only.

.....Also, check to see if in your project you created a WIn32 or a console app..

......give the project a " save all " and rebuild.

Might work??

01-13-2005, 08:06 AM
Oh yeah, and open up a window for ogl yourself.

Check Nehe's lessons on and two.