1

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!

2
  • 4
    @sleeptightpupper RTFM isn't really nice (or professional). Would you respond like that to one of your customers? Commented 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. Commented May 30, 2016 at 18:33

2 Answers 2

4

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
Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.