• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: #if on SDK_NAME
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: #if on SDK_NAME


  • Subject: Re: #if on SDK_NAME
  • From: Steve Christensen <email@hidden>
  • Date: Tue, 14 Jul 2009 16:00:42 -0700

There are two variables defined at compile time: MAC_OS_X_VERSION_MIN_REQUIRED and MAC_OS_X_VERSION_MAX_ALLOWED.

MAC_OS_X_VERSION_MIN_REQUIRED specifies the earliest OS version you support, and corresponds to MACOSX_DEPLOYMENT_TARGET in your project/ target configuration.

MAC_OS_X_VERSION_MAX_ALLOWED specifies the maximum OS version your code knows about, and corresponds to SDKROOT in your project/target configuration.

#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
// do something the Tiger (or pre-Leopard) way
#else
// do something the Leopard and later way
#endif


On Jul 14, 2009, at 3:45 PM, Eric Gorr wrote:

I need to be able to conditionally compile code based upon the SDK being used. In my xcconfig file I have:

SDKROOT_i386	= macosx10.4
SDKROOT_ppc	= macosx10.4
SDKROOT_x86_64	= macosx10.5

I spotted the environment variable SDK_NAME and saw that it was set to macosx10.5

So, I tried putting this in my code:

#if SDK_NAME == macosx10.5
 SInt16 vwForkRef = 0;
#elif
 FSIORefNum vwForkRef = 0;
#endif

However, I get the compile error:

error: missing binary operator before token ".5"

If I remove the .5, the C preprocessor seems to like it.

So, I tried

SDK_NAME == "macosx10.5"
SDK_NAME == 'macosx10.5'
SDK_NAME == macosx10\.5

but it wouldn't accept any of these varients.

Any thoughts?

Attachment: PGP.sig
Description: PGP signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >#if on SDK_NAME (From: Eric Gorr <email@hidden>)

  • Prev by Date: Re: #if on SDK_NAME
  • Next by Date: Re: #if on SDK_NAME
  • Previous by thread: Re: #if on SDK_NAME
  • Next by thread: Re: #if on SDK_NAME
  • Index(es):
    • Date
    • Thread