Why I get errors when I try to out a compiler defined macro using a pragma message?

Posted by bogdan on Stack Overflow See other posts from Stack Overflow or by bogdan
Published on 2010-03-17T19:38:34Z Indexed on 2010/03/17 19:41 UTC
Read the original article Hit count: 277

I would like to know why the Visual C++ compiler gets me an warning/error if I use the following code:

#pragma message( "You have " _MSC_FULL_VER )

Here is what I get:

error C2220: warning treated as error - no 'object' file generated
warning C4081: expected ':'; found ')'

The problem reproduces for _MSC_FULL_VER or _MSV_VER but not if I try to use others like __FILE__ or __DATE__.

These macros are defined, they are documented on msdn

© Stack Overflow or respective owner

Related posts about preprocessor

Related posts about pragma