Tips to Find Predefines for Compilers
01 Jul 2018 Linux tips compilerTwo useful tips from TACC tips regarding compiler macro expanding.
Tip 120:
Want to know what MACROS are predefined by the GCC and Intel compilers? Dogcc -dM -E - < /dev/null > gcc_defined_macros.txt icc -dM -E - < /dev/null > icc_defined_macros.txt
The flag -E
in the tip is telling the compiler to expand macros.
Tip 69:
Having trouble figuring out how a macro is being expanded? Try pasting the line into a terminal and adding a-E
. For example try changingmpicc -DFOO -DBAR -c foo.c
intompicc -DFOO -DBAR -E foo.c > foo.i
and look at thefoo.i
file.
Credits
- TACC - Texas Advanced Computing Center