Is there a preprocessor define that is defined if the compiler is MSVC?
It's _MSC_VER. More info at MSDN and at predef.
But, be aware that some other compilers may also define it, e.g. Intel's C++ Compiler for Windows also defines _MSC_VER. If this is a concern, use #if _MSC_VER && !__INTEL_COMPILER
.
Look at the list of MSVC predefined macros. You'll find what you need.
_MSC_VER
is probably a good one.
_MSC_VER
should fit your needs
_MSC_VER is one such predefined macro.