Possible Duplicate:
Detecting CPU architecture compile-time
Is there a define that GCC sets which tells which CPU (x86/amd64/ppc/etc) GCC is configured for?
So I can use it like:
#ifdef PPCARCH
dosomething();
#endif
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To detect the architecture at compile time in the source code use a predefined macro.
According to this article, it will always have a name in a form
_arch_or__arch__where the arch is the name of the target architecture. To see what exactly defined, use the following command:It will print out all predefined macros.
To print out on the command line, try:
It will show the target the GCC is is built for.