views:

139

answers:

1

We recently had a new requirement to use the phonon component of Qt, which on windows requires Visual Studio.

I installed VS2008 and ran a compile. There are a stack of problems due to make not working anything like nmake.

Since I need to maintain cross-platform I want to test which compiler is being used so that I can make changes as required.

An example is that the PRETTY_FUNCTION is a g++ macro with FUNCDNAME being the VC equivalent. How do I test which compiler I am using to determine which macro to call?

+2  A: 

Use the _MSC_VER macro. If it is defined, you're using Visual Studio:

 #ifdef _MSC_VER
 ... MSVC code ...
 #else
 ... other compiler ...
 #endif
JesperE