Testbed build fails on glutLeaveMainLoop, OSX

Hi There,

The testbed does not compile on OSX due to the addition of glutLeaveMainLoop. This is an addition to the freeglut library, which the testbed doesn't seem to built against on OSX. It seems to be build against OSX's GLUT library.

Code:
Linking CXX static library libglui.a
[ 98%] Built target glui
[ 98%] Building CXX object Testbed/CMakeFiles/Testbed.dir/Framework/Main.cpp.o
/Users/Rick/box2d-read-only/Box2D/Testbed/Framework/Main.cpp: In function ‘void Keyboard(unsigned char, int, int)’:
/Users/Rick/box2d-read-only/Box2D/Testbed/Framework/Main.cpp:134: error: ‘glutLeaveMainLoop’ was not declared in this scope
/Users/Rick/box2d-read-only/Box2D/Testbed/Framework/Main.cpp: In function ‘void Exit(int)’:
/Users/Rick/box2d-read-only/Box2D/Testbed/Framework/Main.cpp:334: error: ‘glutLeaveMainLoop’ was not declared in this scope


Thanks
Rick
The testbed should use the provided freeglut.
From the start of Box2D/glui/GL/glui.h

Code:
#if defined(GLUI_FREEGLUT)

  // FreeGLUT does not yet work perfectly with GLUI
  //  - use at your own risk.
  #include <GL/freeglut.h>

#elif defined(GLUI_OPENGLUT)

  // OpenGLUT does not yet work properly with GLUI
  //  - use at your own risk.

  #include <GL/openglut.h>

#else

  #ifdef __APPLE__
  #include <GLUT/glut.h>
  #else
        #include "../../freeglut/GL/glut.h"
  //#include <GL/glut.h>
  #endif

#endif


I can confirm that the __APPLE__ specific block is being used, and is including a version of glut that does not support glutLeaveMainLoop() (probably from /System/Library/Frameworks/GLUT.framework/).

** Edit ** I was able to get this to compile by replacing

Code:
#include <GLUT/glut.h>


with

Code:
#include "../../freeglut/GL/glut.h"


Once that was done the process was unable to locate GL/gl.h and GL/glu.h

Not being very familiar w/ cmake, I ultimately added the following to Box2D/CMakeLists.txt (/usr/X11/include are where my GL/gl.h and GL/glu.h are)

Code:
INCLUDE_DIRECTORIES("/usr/X11/include")


I'm sure there is a more elegant way to go about this, but I thought I should let you know.

Rick
I read this in the readme.txt file in freeglut 2.8.0-1.mp for MinGW:
If you want your application to be compatible with GLUT, you should include <GL/glut.h>. If you want to use freeglut specific extensions, you should include <GL/freeglut.h>instead.

glutLeaveMainLoop is a new feature added in freeglut, so check your include macro.

Just post in case someone still needs the answer.
I had noticed this too and usually just comment out those two lines.

Original thread: https://box2d.org/forum/viewtopic.php?t=7188