How do I run the GCC preprocessor to get the code after macros like #define are expanded?

gcc

Solution

Yes. Use the `-E` option:

gcc -E foo.c

Problem

Is there an option that the GCC preprocessor could generate C source code and filter out irrelevant source code? For example, a `.c` file has a `#define` switch to define for many different platforms. I'm only interested in one platform, and I want the C preprocessor to filter out unrelated code. Does GCC support this?

Original source

Related problems