Clang + VS2013:包括c + +头时错误(vs2012:工作) [英] Clang+VS2013: error when including c++ header (vs2012:working)

查看:923
本文介绍了Clang + VS2013:包括c + +头时错误(vs2012:工作)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编辑



我找到 http://llvm.org/docs/GettingStartedVS.html


因此,clang无法解析C ++标准库包含
与Visual Studio,也不是Windows平台SDK的部分。


因此,如果不支持C ++

p>我从 http://llvm.org/builds/ 安装了clang可视工作室工具链。
使用VS2013,当编译任何c ++头时,我得到几个错误。
例如:

  #include< memory> 

int main()
{
return 0;
}

这些错误似乎与microsoft的c ++ 14实现有关。
在Visual Studio 2012中不会发生。
在VS2013中切换到工具链 LLVM-vs2012 也可以工作



VS2013 + LLVM-vs2013的错误:

  1&项目:ConsoleApplication1,配置:调试Win32 ------ 
1> clang-cl.exe:warning:参数在编译期间未使用:'/ ZI'
1> clang-cl.exe:warning :编译期间未使用的参数:'/ Gm'
1> clang-cl.exe:warning:参数在编译期间未使用:'/ EHsc'
1> clang-cl.exe:warning:编译:'/ GS'
1> clang-cl.exe:warning:参数在编译期间未使用:'/ fp:precise'
1> clang-cl.exe:warning: '/Ycstdafx.h'
1> clang-cl.exe:warning:参数在编译期间未使用:'/FpDebug\ConsoleApplication1.pch'
1> clang-cl.exe:warning:argument unused在编译期间:'/FdDebug\vc120.pdb'
1> clang-cl.exe:warning:参数在编译期间未使用:'/ Gd'
1> clang-cl.exe:warning:argument在编译期间未使用:'/ ZI'
1> clang-cl.exe:warning:在编译期间未使用参数:'/ Gm'
1> clang-cl.exe:warning: '/ EHsc'
1> clang-cl.exe:warning:编译期间未使用的参数:'/ GS'
1> clang-cl.exe:warning:参数在编译期间未使用:'/ fp:精确'
1> clang-cl.exe:warning:编译期间未使用的参数:'/Yustdafx.h'
1> clang-cl.exe:warning:参数在编译期间未使用:'/ FpDebug\\ \\ConsoleApplication1.pch'
1> clang-cl.exe:warning:参数在编译期间未使用:'/FdDebug\vc120.pdb'
1> clang-cl.exe:warning:编译:'/ Gd'
1>在来自ConsoleApplication1.cpp的文件中:6:
1>在文件包含从C:\Program文件(x86)\Microsoft Visual Studio 12.0 \VC\include \memory:6:
1>在从C:\Program Files(x86)\ Microsoft Visual Studio 12.0 \VC\include\xmemory:6:
1>中包含的文件中。在从C:\Program Files(x86)\ Microsoft Visual Studio 12.0 \VC\include\xmemory0:9:
1>中包含的文件中。在从C:\Program文件(x86)包含的文件中\Microsoft Visual Studio 12.0 \VC\include\xutility:8:
1>在文件包括从C:\Program文件(x86)\Microsoft Visual Studio 12.0 \VC\include\utility:8:
1> C:\Program文件(x86)\Microsoft视觉Studio 12.0 \VC\include\type_traits(620,32):错误:_Ty不引用值
1> :_Cat_base< _IS_CONSTRUCTIBLE(_Ty,_Args ...)>
1> ^
1> C:\Program Files(x86)\Microsoft Visual Studio 12.0 \VC\include\type_traits(617,15):note:declaration here
1> template< class _Ty,
1> ^
1> C:\Program Files(x86)\ Microsoft Visual Studio 12.0 \VC\include\type_traits(621,1):error:expected class name
1> {//确定_Ty(_Args ...)是否可构造
1> ^
1> C:\Program Files(x86)\ Microsoft Visual Studio 12.0 \VC\include\type_traits(746,19):错误:_Ty不引用值
1> _IS_DESTRUCTIBLE(_Ty)
1> ^
1> C:\Program Files(x86)\Microsoft Visual Studio 12.0 \VC\include\type_traits(48,31):note:从宏'_IS_DESTRUCTIBLE'扩展
1> :_Cat_base< __ is_destructible(_Ty)>
1> ^
1> C:\Program Files(x86)\Microsoft Visual Studio 12.0 \VC\include\type_traits(744,15):note:decl here
1> template< class _Ty>
1> ^
1> C:\Program Files(x86)\ Microsoft Visual Studio 12.0 \VC\include\type_traits(747,1):error:expected class name
1> {//确定_Ty是否有析构函数
1> ^
1> C:\Program文件(x86)\ Microsoft Visual Studio 12.0 \VC\include\type_traits(887,40):错误:_Ty不引用值
1> :_Cat_base< _IS_NOTHROW_CONSTRUCTIBLE(_Ty,_Args ...)>
1> ^
1> C:\Program Files(x86)\Microsoft Visual Studio 12.0 \VC\include\type_traits(884,15):note:decl here
1> template< class _Ty,
1> ^
1> C:\Program Files(x86)\ Microsoft Visual Studio 12.0 \VC\include\type_traits(888,1):error:expected class name
1> {//确定_Ty(_Args ...)是否不可构造
1> ^
1> C:\Program文件(x86)\ Microsoft Visual Studio 12.0 \VC\include\type_traits(951,25):错误:_To不引用值
1> _IS_NOTHROW_ASSIGNABLE(_To,_From)
1> ^
1> C:\Program Files(x86)\Microsoft Visual Studio 12.0 \VC\include\type_traits(50,37):note:从宏_IS_NOTHROW_ASSIGNABLE扩展
1> :_Cat_base< __ is_nothrow_assignable(_To,_From)>
1> ^
1> C:\Program Files(x86)\Microsoft Visual Studio 12.0 \VC\include\type_traits(947,15):note:declaration here
1> template< class _To,
1> ^
1> C:\Program Files(x86)\ Microsoft Visual Studio 12.0 \VC\include\type_traits(953,1):error:expected class name
1> {//确定_From是否可以分配给_To,nothrow
1> ^
1> C:\Program文件(x86)\ Microsoft Visual Studio 12.0 \VC\include\type_traits(1000,27):错误:'_Ty'不引用值
1> _IS_NOTHROW_DESTRUCTIBLE(_Ty)
1> ^
1> C:\Program Files(x86)\ Microsoft Visual Studio 12.0 \VC\include\type_traits(52,39):note:从宏_IS_NOTHROW_DESTRUCTIBLE扩展
1> :_Cat_base< __ is_nothrow_destructible(_Ty)>
1> ^
1> C:\Program Files(x86)\Microsoft Visual Studio 12.0 \VC\include\type_traits(997,15):note:declaration here
1> template< class _Ty>
1> ^
1> C:\Program Files(x86)\ Microsoft Visual Studio 12.0 \VC\include\type_traits(1002,1):error:expected class name
1> {//确定_Ty是否有一个nothrow析构函数
1> ^
1> 10错误生成。

在命令行上运行 clang -v 输出

  clang版本3.4(195641)
目标:i686-pc-win32
线程模型:posix

任何人都可以重现此错误?如果是,我将在 http://llvm.org/bugs/ 创建错误报告。

解决方案

正在跟踪此错误: http://llvm.org/bugs/show_bug.cgi?id=17926



有关详情,请参阅评论部分。


Edit

i found http://llvm.org/docs/GettingStartedVS.html

Because of this, clang cannot parse the C++ standard library included with Visual Studio, nor parts of the Windows Platform SDK.

So, if C++ is not supported with Visual Studio headers, should i still write a bug report?

Q:

I installed the clang visual studio toolchain from http://llvm.org/builds/. Using VS2013, i get several errors when compiling any c++ header. For example:

#include <memory>

int main()
{
    return 0;
}

These errors seem to be related to microsofts c++14 implementation. This does NOT occur in Visual Studio 2012. Switching to the Toolchain LLVM-vs2012 in VS2013 also works

Errors with VS2013+LLVM-vs2013:

1>------ Build started: Project: ConsoleApplication1, Configuration: Debug Win32 ------
1>clang-cl.exe : warning : argument unused during compilation: '/ZI'
1>clang-cl.exe : warning : argument unused during compilation: '/Gm'
1>clang-cl.exe : warning : argument unused during compilation: '/EHsc'
1>clang-cl.exe : warning : argument unused during compilation: '/GS'
1>clang-cl.exe : warning : argument unused during compilation: '/fp:precise'
1>clang-cl.exe : warning : argument unused during compilation: '/Ycstdafx.h'
1>clang-cl.exe : warning : argument unused during compilation: '/FpDebug\ConsoleApplication1.pch'
1>clang-cl.exe : warning : argument unused during compilation: '/FdDebug\vc120.pdb'
1>clang-cl.exe : warning : argument unused during compilation: '/Gd'
1>clang-cl.exe : warning : argument unused during compilation: '/ZI'
1>clang-cl.exe : warning : argument unused during compilation: '/Gm'
1>clang-cl.exe : warning : argument unused during compilation: '/EHsc'
1>clang-cl.exe : warning : argument unused during compilation: '/GS'
1>clang-cl.exe : warning : argument unused during compilation: '/fp:precise'
1>clang-cl.exe : warning : argument unused during compilation: '/Yustdafx.h'
1>clang-cl.exe : warning : argument unused during compilation: '/FpDebug\ConsoleApplication1.pch'
1>clang-cl.exe : warning : argument unused during compilation: '/FdDebug\vc120.pdb'
1>clang-cl.exe : warning : argument unused during compilation: '/Gd'
1>  In file included from ConsoleApplication1.cpp:6:
1>  In file included from C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\memory:6:
1>  In file included from C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xmemory:6:
1>  In file included from C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xmemory0:9:
1>  In file included from C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility:8:
1>  In file included from C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\utility:8:
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(620,32): error : '_Ty' does not refer to a value
1>                  : _Cat_base<_IS_CONSTRUCTIBLE(_Ty, _Args...)>
1>                                                ^
1>  C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(617,15) :  note: declared here
1>  template<class _Ty,
1>                 ^
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(621,1): error : expected class name
1>          {       // determine whether _Ty(_Args...) is constructible
1>          ^
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(746,19): error : '_Ty' does not refer to a value
1>                  _IS_DESTRUCTIBLE(_Ty)
1>                                   ^
1>  C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(48,31) :  note: expanded from macro '_IS_DESTRUCTIBLE'
1>          : _Cat_base<__is_destructible(_Ty)>
1>                                        ^
1>  C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(744,15) :  note: declared here
1>  template<class _Ty>
1>                 ^
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(747,1): error : expected class name
1>          {       // determine whether _Ty has a destructor
1>          ^
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(887,40): error : '_Ty' does not refer to a value
1>                  : _Cat_base<_IS_NOTHROW_CONSTRUCTIBLE(_Ty, _Args...)>
1>                                                        ^
1>  C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(884,15) :  note: declared here
1>  template<class _Ty,
1>                 ^
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(888,1): error : expected class name
1>          {       // determine whether _Ty(_Args...) is nothrow constructible
1>          ^
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(951,25): error : '_To' does not refer to a value
1>                  _IS_NOTHROW_ASSIGNABLE(_To, _From)
1>                                         ^
1>  C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(50,37) :  note: expanded from macro '_IS_NOTHROW_ASSIGNABLE'
1>          : _Cat_base<__is_nothrow_assignable(_To, _From)>
1>                                              ^
1>  C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(947,15) :  note: declared here
1>  template<class _To,
1>                 ^
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(953,1): error : expected class name
1>          {       // determine whether _From can be assigned to _To, nothrow
1>          ^
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(1000,27): error : '_Ty' does not refer to a value
1>                  _IS_NOTHROW_DESTRUCTIBLE(_Ty)
1>                                           ^
1>  C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(52,39) :  note: expanded from macro '_IS_NOTHROW_DESTRUCTIBLE'
1>          : _Cat_base<__is_nothrow_destructible(_Ty)>
1>                                                ^
1>  C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(997,15) :  note: declared here
1>  template<class _Ty>
1>                 ^
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(1002,1): error : expected class name
1>          {       // determine whether _Ty has a nothrow destructor
1>          ^
1>  10 errors generated.

running clang -v on the command line outputs

clang version 3.4 (195641)
Target: i686-pc-win32
Thread model: posix

Can any of you reproduce this error? If yes, i would create a bugreport at http://llvm.org/bugs/.

解决方案

The bug is being tracked here: http://llvm.org/bugs/show_bug.cgi?id=17926

See the comment section for further info.

这篇关于Clang + VS2013:包括c + +头时错误(vs2012:工作)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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