XCode 3.0 ( Leopard )

i just checked out the new 0.03 release. when i try to compile it i get an error ‘ofGraphics.cpp’. after some fiddling around i found out that it seems to be not necessary to write the extra code for OS X in the ‘gluTessCallback’ section. by removing the ‘#ifdef’ stuff and the OS X specific code block, i got it running again.

change

  
  
	#if defined( TARGET_WIN32) || defined( TARGET_LINUX )  
		gluTessCallback( tobj, GLU_TESS_BEGIN, (void(CALLBACK*)())&glBegin);  
		gluTessCallback( tobj, GLU_TESS_VERTEX, (void(CALLBACK*)())&tessVertex);  
		gluTessCallback( tobj, GLU_TESS_COMBINE, (void(CALLBACK*)())&tessCombine);  
		gluTessCallback( tobj, GLU_TESS_END, (void(CALLBACK*)())&glEnd);  
		gluTessCallback( tobj, GLU_TESS_ERROR, (void(CALLBACK*)())&tessError);  
	#else  
		// xcode / osx complained, so we write it the way that makes it happy:  
		gluTessCallback( tobj, GLU_TESS_BEGIN, (void(CALLBACK*)(...))&glBegin);  
		gluTessCallback( tobj, GLU_TESS_VERTEX, (void(CALLBACK*)(...))&tessVertex);  
		gluTessCallback( tobj, GLU_TESS_COMBINE, (void(CALLBACK*)(...))&tessCombine);  
		gluTessCallback( tobj, GLU_TESS_END, (void(CALLBACK*)(...))&glEnd);  
		gluTessCallback( tobj, GLU_TESS_ERROR, (void(CALLBACK*)(...))&tessError);  
	#endif  
  

to

  
  
	gluTessCallback( tobj, GLU_TESS_BEGIN, (void(CALLBACK*)())&glBegin);  
	gluTessCallback( tobj, GLU_TESS_VERTEX, (void(CALLBACK*)())&tessVertex);  
	gluTessCallback( tobj, GLU_TESS_COMBINE, (void(CALLBACK*)())&tessCombine);  
	gluTessCallback( tobj, GLU_TESS_END, (void(CALLBACK*)())&glEnd);  
	gluTessCallback( tobj, GLU_TESS_ERROR, (void(CALLBACK*)())&tessError);  
  

[/code]

Yeah there is an issue with OS X (fixed in 10.5 I imagine ) where it doesn’t like that there is no indication of the arguments for a callback.

In 10.4 if you don’t put the (…) in:
(void(CALLBACK*)(…))&glBegin

Then you get an error because the types don’t match.
invalid conversion from ‘void (*)()’ to ‘GLvoid (*)(…)’

The … stands for ‘arguments not specified’ and I think is technically the correct but kind of anal response.

– old post
Hey - good catch!

Strange, now that I try it it works fine for me too (Xcode 2.4.1 Tiger) - but I remember it not working and then learning all about the “…” stuff.

Thanks for finding that - it is certainly nicer to look out without the #ifdef stuff.

Does everything else compile nicely in Leopard?
I was expecting there to be quite a few Xcode 3.0, OS X 10.5 issues.

Whoops, spoke too soon.

I’ll see if I can get it working without making two separate versions otherwise I’ll need to add some #ifdef XCODE 3.0 stuff!

Here is some cool code to figure out what version of OS X someone is running though.

  
  
    SInt32 system_version;  
      
    if ( Gestalt(gestaltSystemVersion, &system_version) != noErr )  
    {  
        system_version = 0;  
        printf("Error getting OS X System Version\n");  
          
    }  
	  
	SInt32 major_version = (system_version & 0xFF00) >> 8;  
    SInt32 minor_version = (system_version & 0x00F0) >> 4;  
    SInt32 point_version = (system_version & 0x000F);  
  
    // Print as string:  
    printf("Mac OS X %x.%d.%d ", major_version, minor_version, point_version);  

Okay I think I have it.

Would you mind testing some code for me?

I found some interesting stuff in
/usr/include/AvailabilityMacros.h

Which should let me detect OS X 10.5

Would you mind replacing the code you modified in ofGraphics.cpp with the code bellow and see if it compiles for you.

  
	#if defined( TARGET_WIN32) || defined( TARGET_LINUX ) || defined( MAC_OS_X_VERSION_10_5 )  
		gluTessCallback( tobj, GLU_TESS_BEGIN, (void(CALLBACK*)())&glBegin);  
		gluTessCallback( tobj, GLU_TESS_VERTEX, (void(CALLBACK*)())&tessVertex);  
		gluTessCallback( tobj, GLU_TESS_COMBINE, (void(CALLBACK*)())&tessCombine);  
		gluTessCallback( tobj, GLU_TESS_END, (void(CALLBACK*)())&glEnd);  
		gluTessCallback( tobj, GLU_TESS_ERROR, (void(CALLBACK*)())&tessError);  
	#else  
		// xcode / osx complained, so we write it the way that makes it happy:  
		gluTessCallback( tobj, GLU_TESS_BEGIN, (void(CALLBACK*)(...))&glBegin);  
		gluTessCallback( tobj, GLU_TESS_VERTEX, (void(CALLBACK*)(...))&tessVertex);  
		gluTessCallback( tobj, GLU_TESS_COMBINE, (void(CALLBACK*)(...))&tessCombine);  
		gluTessCallback( tobj, GLU_TESS_END, (void(CALLBACK*)(...))&glEnd);  
		gluTessCallback( tobj, GLU_TESS_ERROR, (void(CALLBACK*)(...))&tessError);  
	#endif  

Thanks!
Theo

Hmm it now looks like it is more to do with the GCC version installed.
It also doesn’t like the callback code on 10.4.10 which I think is when apple switched to GCC 4.3.

Looking for a solution but if you are getting errors in this point and you are on 10.4.10 just make sure you use the 10.5 way (first block of code) and not the 10.4 way.