Preprocessor variable for detecting platform

John (Eljay) Love-Jensen eljay@adobe.com
Thu Mar 5 15:58:00 GMT 2009


Hi Dale,

> how do I determine what the appropriate preprocessor
variable that would indicate for example, being on a Linux platform vs
an AIX platform.

Refer to the GCC documentation for that platform, man gcc

Use this trick to view the predefined preprocessor identifiers
echo '' | gcc -E -dM -x c - | sort

Hopefully the relevant one is obvious.  (Sometimes there are a few that look appropriate, which requires a little more documentation diving investigation.)

HTH,
--Eljay



More information about the Gcc-help mailing list