为什么在Visual Studio中使用LLVM + Clang时未定义__clang__? [英] Why isn't __clang__ defined when using LLVM+Clang in Visual Studio?

查看:131
本文介绍了为什么在Visual Studio中使用LLVM + Clang时未定义__clang__?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装了Windows的LLVM,其中包括Clang和其他一些工具.它与Visual Studio集成,甚至允许我在项目属性中选择平台工具集".但是,当我选择LLVM附带的任何工具集时,未定义__clang__,而是定义了_MSC_VER.在Visual Studio中使用LLVM和Clang时如何定义__clang__?

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?

我的Visual Studio版本是2015 Preview(但是我也在2013年进行了测试,也没有成功),而我的LLVM版本是基于SVN 225473版本的.我尝试了LLVM-vs2012LLVM-vs2013LLVM-vs2014作为平台工具集没有成功.

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.

推荐答案

在项目属性"->"C/C ++"->预处理器"->预处理器定义"下,添加__clang__.是的,这只是一种解决方法.

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

这篇关于为什么在Visual Studio中使用LLVM + Clang时未定义__clang__?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆