How to debug macros efficiently in VS?

前端 未结 9 1743
情书的邮戳
情书的邮戳 2021-02-01 22:38

I\'ve got a pretty complicated macro inside my (unmanaged) C++ code. Is there any way to expand macros in VS debugger? Or maybe there is another way to debug macros there?

9条回答
  •  盖世英雄少女心
    2021-02-01 22:39

    Go to either project or source file properties by right-clicking and going to "Properties". Under Configuration Properties->C/C++->Preprocessor, set "Generate Preprocessed File" to either with or without line numbers, whichever you prefer. This will show what your macro expands to in context. If you need to debug it on live compiled code, just cut and paste that, and put it in place of your macro while debugging.

提交回复
热议问题