Hello,

On OS X 0.9.11-pre1 works fine. I've begun trying to get the OSG
version to compile now, and I've run up against this problem, which
has been discussed before. I'm going to try to explain the problem in
terms that I feel would have helped me get to the bottom of
understanding the problem sooner, for posterity's sake. Maybe some
problem-solving discussion will also come of it.

When compiling ATC/atis.cxx I get errors like the following:

/Library/Frameworks/osg.framework/Headers/BufferObject:181: error:
expected `)' before '*' token

Line 181 in the BufferObject header is

typedef void (APIENTRY * GenBuffersProc) (GLsizei n, GLuint *buffers);

If you define APIENTRY in config.h or some other generic place, either
in flightgear or simgear, you will still find that APIENTRY is
undefined at this point, because Apple's GLUT/glut.h (located at
/System/Library/Frameworks/GLUT.framework/Versions/A/Headers/glut.h on
my system) has the following code at the beginning:

/* define APIENTRY and CALLBACK to null string if we aren't on Win32 */
#if !defined(_WIN32)
#define APIENTRY
#define GLUT_APIENTRY_DEFINED
#define CALLBACK
#endif

and the following code at the end:

#ifdef GLUT_APIENTRY_DEFINED
# undef GLUT_APIENTRY_DEFINED
# undef APIENTRY
#endif

Now, the obvious problem here is that regardless of whether APIENTRY
was defined upon entering this file, it will be undefined upon leaving
it. I believe the following patch to glut.h is the correct fix:

--- /tmp/glut.h 2007-06-26 17:51:02.000000000 -0600
+++ /System/Library/Frameworks/GLUT.framework/Headers/glut.h
2007-06-26 17:56:46.000000000 -0600
@@ -65,8 +65,10 @@

 /* define APIENTRY and CALLBACK to null string if we aren't on Win32 */
 #if !defined(_WIN32)
-#define APIENTRY
-#define GLUT_APIENTRY_DEFINED
+#ifndef APIENTRY
+# define APIENTRY
+# define GLUT_APIENTRY_DEFINED
+#endif
 #define CALLBACK
 #endif

However, this is of course not our playing field. When I patch my
glut.h like that, atis.cxx compiles fine.

glut.h is being included by plib/pu.h, which is included in 16 places
in FlightGear (none in SimGear), so if we intelligently redefined
APIENTRY after each of those includes (being careful not to define it
to nil on Windows) that might be something we could do directly. Or
perhaps better, create a wrapper header for pu.h that does that in one
place, so we avoid repeating ourselves.

In simgear/math/SGMath.hxx we have the following:

#include <osg/GL>
#undef GLUT_APIENTRY_DEFINED // GL/glut.h undef APIENTRY when this
symbol is defi
ned. osg/GL defines it (?).
                             // This probably would work if we didn't
use plib/pu
.h that include GL/glut.h
                             //  on its side.

osg/GL does define GLUT_APIENTRY_DEFINED, but only on Windows. In any
case, the problem is not that GLUT_APIENTRY_DEFINED is set upon
entering glut.h, because glut.h sets it all by itself. So that undef
could probably be removed.

Freeglut does not seem to be so afflicted, which is why it works on
linux for most people.

It would be prudent to report the bug in GLUT to GLUT and your
system's maintainers if you use a system with real GLUT (e.g. report
to apple on OS X).

I'm hoping this message has provided enough information for
individuals to work around the problem, and for us to find a solution
to work around GLUT's deficiency while we wait with bated breath for
them to fix it (ha).

-- 
Hans Fugal
Fugal Computing

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to