1

I am working on a big C project with MSVC compiler cl.exe. Many code are conditioned on macro definitions. So is it possible to generate an effective list of defined macros as the side output of the compilation process. So I can know which part of the code are active for the compile.

ADD 1

The thread mentioned in the comment doesn't solve my problem. It only shows how to get the intermediate pre-processing results of each source file. But what I want is an effective list of defined macros for the whole project.

I need this because some C projects need to be configured before compilation. And the configuration is carried out by defining/un-defining various macros. If I had a final effective list of defined macros, I can easily see if I configured the projects correctly.

Community
  • 1
  • 1
smwikipedia
  • 61,609
  • 92
  • 309
  • 482
  • 1
    Possible duplicate of [How do I see a C/C++ source file after preprocessing in Visual Studio?](http://stackoverflow.com/questions/277258/how-do-i-see-a-c-c-source-file-after-preprocessing-in-visual-studio) – LPs Aug 02 '16 at 06:39
  • @LPs Thanks but that thread doesn't solve my question. I updated my question. – smwikipedia Aug 11 '16 at 07:47

1 Answers1

0

You could use Visual Studio Class View window to list all defined macro:

enter image description here

This, however, would not show preprocessor definitions, declared in the project options. There is no compiler switch, that would allow to list all effective defines in the compilation output. However you could use /P and /E switches to examine preprocessed output and see what code is actually goes for compiling.

Ari0nhh
  • 5,720
  • 3
  • 28
  • 33