Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why isn't __clang__ defined when using LLVM+Clang in Visual Studio?

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.

like image 365
Adrian Collado Avatar asked Jan 19 '15 03:01

Adrian Collado


1 Answers

Under Project Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions, add __clang__. Yes, this is just a workaround.

like image 157
Matthew Grivich Avatar answered Sep 19 '22 18:09

Matthew Grivich