OpenGL DevC++ set up problems

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

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

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

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

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

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

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

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

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