How do I see a C/C++ source file after preprocessing in Visual Studio?

前端 未结 10 893
一个人的身影
一个人的身影 2020-11-22 05:44

Let\'s say I have a source file with many preprocessor directives. Is it possible to see how it looks after the preprocessor is done with it?

10条回答
  •  北荒
    北荒 (楼主)
    2020-11-22 06:21

    cl.exe, the command line interface to Microsoft Visual C++, has three different options for outputting the preprocessed file (hence the inconsistency in the previous responses about Visual C++):

    • /E: preprocess to stdout (similar to GCC's -E option)
    • /P: preprocess to file
    • /EP: preprocess to stdout without #line directives

    If you want to preprocess to a file without #line directives, combine the /P and /EP options.

提交回复
热议问题