laurent
laurent

Reputation: 90804

How to view the content of a C++ macro?

I have a macro that is dynamically generated before compilation (it's supposed to contain the build number). However I think there's some error with the way it's generated so I would like to check the content of this macro. How can I do that?

I'm using the MSVC2008 compiler.

Upvotes: 0

Views: 340

Answers (2)

Alok Save
Alok Save

Reputation: 206566

You can use /p option and write preprocessor output to a file. Or
You can use /E option and write preprocessor output to stdout

Upvotes: 2

Crashworks
Crashworks

Reputation: 41444

You can set the "Preprocess to a file" option on the project or file's properties to true. That will let you see exactly what the preprocessor emits.

(It's under Configuration Properties → C/C++ → Preprocessor.)

Upvotes: 2

Related Questions