问题
I installed LLVM for Windows, which includes Clang and a few other tools. It integrates with Visual Studio, and even lets me choose a "Platform Toolset" in the project properties. However, when I choose any of the toolsets that came with LLVM, __clang__ isn't defined, and _MSC_VER is defined instead. How do I make __clang__ defined when using LLVM and Clang in Visual Studio?
My Visual Studio version is the 2015 Preview (however I have also tested on 2013 with no success either), and my LLVM version is based off of SVN release 225473. I've tried LLVM-vs2012, LLVM-vs2013, and LLVM-vs2014 as the Platform Toolset without success.
回答1:
Under Project Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions, add __clang__. Yes, this is just a workaround.
来源:https://stackoverflow.com/questions/28017400/why-isnt-clang-defined-when-using-llvmclang-in-visual-studio