Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 8 months ago.
How can I show which compiler was used?
I am copying some projects from mbed to LPCXpresso to allow me to work offline. I want to be able to compile the projects either online or offline and I would like to indicate which compiler was used as part of the sign-on message. I thought I could use the compiler predefines __arm__ and __GNUC__ and wrote the following code:
pc.printf("\nKeypad library test harness (Version %s, %s %s) ", VERSION, __DATE__, __TIME__); #ifdef __arm__ pc.printf("Cloud Compiler\n"); #endif #ifdef __GNUC__ pc.printf("GCC\n"); #endif
Unfortunately, I get the same message for both online and offline builds:
Keypad library test harness (Version 0.43, Sep 28 2013 17:03:45) Cloud Compiler GCC
It seems that both constants are defined in both compilers! Does anybody know how to do this?
1 Answer
10 years, 8 months ago.
Hello Paul Griffith,
here's a list of many compiler's macros: http://sourceforge.net/p/predef/wiki/Compilers/
for online compiler
__CC_ARM
for GCC
__GNUC__
Regards,
0xc0170