Viewing compiler expanded code - C++

后端 未结 5 680
無奈伤痛
無奈伤痛 2021-01-04 09:36

I learned that compiler will expand macros while compiling. Templates are also expanded at the compile time. Is there any way to see this expanded code? I am compiling using

5条回答
  •  时光说笑
    2021-01-04 09:54

    The VC++ compiler (cl.exe) supports a few command line switches for this:

    /E preprocess to stdout
    /P preprocess to file
    /EP preproscess to stdout with no #lines
    

    Additional command-line switches can be added in your project properties. In my version (VC2005), Configuration Options -> C/C++ -> Command Line -> Additional Options

提交回复
热议问题