Re: I need to know which compiler or environment my code is being compiled in . . .
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: Chris Espinosa <email@hidden>
- Date: Fri, 7 Aug 2009 16:26:17 -0700
On Aug 7, 2009, at 4:13 PM, Alastair Houghton wrote:
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.
The easier way to do this (and get more precise, per-target-per-
configuration results from Xcode) is to select a source file, Get
Info, click the Build tab, add -dM to it, then Preprocess that source
file.
Chris
_______________________________________________
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