Does there exists a flag that I can pass to one of these preprocessors that causes the preprocessor to not resolve any macros in the code? I"m trying to use it just to concatenate any included header files into one file. Thanks!
-
4@sleeptightpupper RTFM isn't really nice (or professional). Would you respond like that to one of your customers?πάντα ῥεῖ– πάντα ῥεῖ2016-05-30 18:26:56 +00:00Commented May 30, 2016 at 18:26
-
Thanks for the help. I tried looking in a couple different places but wasn't looking in the right place. Sorry if that seemed like a dumb question, I really did try to find the answer.rreichel– rreichel2016-05-30 18:33:03 +00:00Commented May 30, 2016 at 18:33
Add a comment
|
2 Answers
From the manual
-fdirectives-only
When preprocessing, handle directives, but do not expand macros.
Read the full entry for complete details.
Add the -P option to suppress #line directives, e.g.
g++ -E -P -fdirectives-only ... file.cpp
or:
cpp -P -fdirectives-only ... file.cpp
Comments
AFAIK there is no such flag. If you only want to concatenate header files - go ahead and write a short program for this.
You may anyway need sch program as the preprocessor does more than including headers and extending macros. It is also responsible e.g. for concatenating string literals, so e.g. "This""And""That" is turned into "ThisAndThat". So you will get some unexpected changes in your sources anyway.