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

余生长醉 提交于 2019-12-19 06:37:18

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!