Author Topic: Code Blocks Error Message with GLUT  (Read 51523 times)

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Code Blocks Error Message with GLUT
« Reply #15 on: October 05, 2005, 06:53:54 pm »
This seems rather interesting. Thomas, perhaps you could do some postings in glut-related forums and present a "Don't use GLUT" or "Use GLFW" initiative? Or at least ask why people don't use glfw...

himaja

  • Guest
program crashes with a Windows error message
« Reply #16 on: October 06, 2005, 07:11:21 am »

"The dynamic link library glut32.dll could not be found in C:\................................."very long file path which starts with where my cpp file sits and adds all these others weird C:\ paths to it.  What is wrong now?
That means you have to either copy the dll into the same directory where your program is (happens to be your project folder), or anywhere in your  PATH so the system can find it (most people use C:\windows or C:\windows\system32 for that matter).

I have copied the DLL to the same directory.  Now when i compile and run, i don't but that error anymore, but now it seems to crash.  I the the message, my application has generated errors and will be closed by windows, an error report is being created.  Whats the deal with that now?

Thanks everyone for responding and helping me out. I am now having the "program crashes with a Windows error message" right now - my code is really simple, just a downloaded tutorial to try out GLUT:

#include <gl/glut.h>

void renderScene(void) {
   glClear(GL_COLOR_BUFFER_BIT);
   glBegin(GL_TRIANGLES);
      glVertex3f(-0.5,-0.5,0.0);
      glVertex3f(0.5,0.0,0.0);
      glVertex3f(0.0,0.5,0.0);
   glEnd();
   glFlush();
}

int main(int argc, char **argv) {
   glutInit(&argc, argv);
   glutInitDisplayMode(GLUT_DEPTH | GLUT_SINGLE | GLUT_RGBA);
   glutInitWindowPosition(100,100);
   glutInitWindowSize(320,320);
   glutCreateWindow("3D Tech- GLUT Tutorial");
   glutDisplayFunc(renderScene);
   glutMainLoop();
   return 0;
}

Also, I have been trying out GLUT because I want to create some simple GUIs for the program I am working on, along with some graphics and 3-D modelling, and GOOGLE suggested GLUT :) I would really appreciate it f anyone can suggest a better package for building Windows, buttons, menus etc.

Thanks,
Himaja.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: program crashes with a Windows error message
« Reply #17 on: October 06, 2005, 01:14:45 pm »
[...] building Windows, buttons, menus etc.
GLUT does not build any buttons or menus (you can create popup menus, but not a "menu" in the normal sense).

If you want something very similar to GLUT (maybe because you already spent time learning it), you are off best with freeglut (http://freeglut.sourceforge.net).
If you want a really good lightweight OpenGL toolkit, but you don't need popup menus and rather useless geometric modelling functions (like glutWireCube), then GLFW (http://glfw.sourceforge.net) is certainly the best choice.

If you absolutely must have menus and buttons and OpenGL, you will need to use either FLTK (http://www.fltk.org) or wxWidgets (http://www.wxwidgets.org).
wxWidgets has a very nice looking web page and a lot of shining features, but it is an ugly clumsy beast, painful to build and really huge. Also note that wxWidgets breaks STL by redefining new in a macro. If you have the habit to use STL, you must #undef new first (see wxWidgets FAQ).
FLTK looks like crap when you visit their website, but it really does a good job. It is small, lightweight, and easy to program with. There is a RAD editor coming with it, too. The 1.1x branch is 'stable', and 2.0 is 'alpha'. Building is nearly as painful as building wxWidgets, but there are binary DevPaks ;)

If you want to create windows, buttons, and menus inside your OpenGL context, you might want to look at GLUI (http://www.nigels.com/glt/glui) or at Crazy Eddie's GUI. The latter was still quite awful when I last looked at it a year or so ago, but it now ships with OGRE, so I guess that it has been drastically improved.

EDIT:
The code above looks like it should work. There is only one mistake in it, but that cannot possibly cause a crash. You forgot to set a vertex colour, so it would probably render all black. Are you maybe using some weird optimisation options (regparam comes to my mind), and have you made sure you use pristine versions of the GLUT library files? Maybe you experience DLL hell?
« Last Edit: October 06, 2005, 01:26:09 pm by thomas »
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

himaja

  • Guest
Re: program crashes with a Windows error message
« Reply #18 on: October 10, 2005, 06:32:17 pm »



Thank you for all the info about the various toolkits :) I decided to give up on GLUT (since it is still crashing without showing any output - anyone know a solution to that????) and go with WxWidgets instead. glut DOES seem to be DLL hell, overall. I am an experienced PROGRESS developer trying to get a software completed in C++, and I must say that Code::Blocks is a really great tool to use. And this forum is a godsend!!! Thank you, everyone, for helping out.
Himaja.

Offline petsagouris

  • Single posting newcomer
  • *
  • Posts: 5
    • arhitektonas
Re: Code Blocks Error Message with GLUT
« Reply #19 on: November 12, 2008, 02:14:02 pm »
I know I am digging an old thread (dead even), but I wanted to post some corrections to the procedure for setting up ol'n'dead GLUT on Code::Blocks and MinGW.

Follow through the tutorial on the Lawrence Goetz page. Before you try compiling the test project edit the following

in glut.h

on line 10 change
Code
# if 0 
to
Code
# if (_WIN_ALL)
Then go in the Project -> Build Options... ->#defines and add : _WIN_ALL
This should correct the error: redeclaration of C++ built-in type `short'

on line 100 add
Code
#define GLUT_DISABLE_ATEXIT_HACK
This should correct the warning: 'int glutCreateMenu_ATEXIT_HACK(void (*)(int))' defined but not used

slowcook

  • Guest
Re: Code Blocks Error Message with GLUT
« Reply #20 on: December 03, 2009, 02:58:16 pm »
I just had this problem (Running windows with MinGW) and fixed it by adding

#include <windows.h>

to the project file.

Edit: the "C:/Program Files/CodeBlocks/include/GL/glut.h:50: error: redeclaration of C++ built-in type `short'" problem
« Last Edit: December 03, 2009, 03:01:04 pm by slowcook »