OpenGL DevC++ set up problems

I’ve got a few options here…
For headers I have:

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


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:


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

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.

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();


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

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


  // Register the event callback functions

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


 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);

  glutAddMenuEntry("Exit", 0);

} // end Initialize()

 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)
    } break;

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


 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
    } break;
    } break;
} // end KeyboardHandler()


 Main menu callback.
void MainMenuHandler(int option)
  case 0:
    } break;
} // end MainMenuHandler()


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


 Reset the viewport for window changes
void Reshape(int width, int height)
  if (height == 0)

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

} // end Reshape


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

  // clear the screen

  // draw a triangle
    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);

  // draw a 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);

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

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:


SO you should give it a shot

But your not linking glut which is what i needed. And isn’t gluax really freaking old and unsupported?

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…

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\”
Finding dependencies for file: C:\Dev-Cpp\WavesCode.cpp
Executing make…
make.exe -f “C:\Dev-Cpp\” all
make.exe: *** No rule to make target d', needed byWavesCode.o’. Stop.

Execution terminated

tell me if you want the files

(sorry about the triple post)

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

Compiler: Default compiler
Building Makefile: "C:\Dev-Cpp\"
Finding dependencies for file: C:\Dev-Cpp\b.cpp
Executing  make...
make.exe -f "C:\Dev-Cpp\" 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

>> 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 :

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

Yes ZBuffer, I realized that last night, but thanks anyways. once I fixed that it has a problem with the

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

Execution terminated

any ideas what this means?

YES!! I got it to compile and run!! Although, I am not sure if it does what it is supposed to do.