c++ – How can I find out a list of all defined macros?


How do you find out which macros are defined in one particular translation unit? Is there a way to print such a list of names?


To do this, use the -dM -E options of the GCC compiler.

gcc -dM -E prog.c

The directives declaring macros will be output to the standard stream, to the terminal. The list includes not only those names that were declared explicitly in the source code, but also internal macros predefined and specified on the command line – the -D arguments.

Scroll to Top