• 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: I need to know which compiler or environment my code is being compiled in . . .
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: I need to know which compiler or environment my code is being compiled in . . .


  • Subject: Re: I need to know which compiler or environment my code is being compiled in . . .
  • From: Alastair Houghton <email@hidden>
  • Date: Sat, 8 Aug 2009 00:13:22 +0100

On 7 Aug 2009, at 21:31, Michael A. Crawford wrote:

Hi, I'm looking for information on Xcode or the preprocessor that would indicate whether or not my code is being compiled for a non Mac GNU target or Mac OS X or iPhone OS.

What are the relevant defines and where can I find them in the documentation? Apparently I'm not using the correct keywords in my Google search or Xcode's documentation search window.

You can get a list of predefined macros using

  gcc -E -dM -x c /dev/null

which is usually quite a useful way of finding things you can test for these kinds of purposes. If you're interested in a language other than plain C, you can specify that after the "-x" (e.g. "objective-c", "c++").

Most platforms define some macros of their own that you can look for. Be careful, though; you shouldn't really test for a platform by looking for e.g. a processor-related macro.

Kind regards,

Alastair.

--
http://alastairs-place.net



_______________________________________________
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


  • Follow-Ups:
    • Re: I need to know which compiler or environment my code is being compiled in . . .
      • From: Chris Espinosa <email@hidden>
References: 
 >I need to know which compiler or environment my code is being compiled in . . . (From: "Michael A. Crawford" <email@hidden>)

  • Prev by Date: Re: I need to know which compiler or environment my code is being compiled in . . .
  • Next by Date: Re: I need to know which compiler or environment my code is being compiled in . . .
  • Previous by thread: Re: I need to know which compiler or environment my code is being compiled in . . .
  • Next by thread: Re: I need to know which compiler or environment my code is being compiled in . . .
  • Index(es):
    • Date
    • Thread