【发布时间】:2013-12-14 03:02:33
【问题描述】:
编辑
我找到了http://llvm.org/docs/GettingStartedVS.html
正因为如此,clang 无法解析包含的 C++ 标准库 使用 Visual Studio,也不是 Windows Platform SDK 的一部分。
那么,如果 Visual Studio 标头不支持 C++,我还应该写错误报告吗?
问:
我从http://llvm.org/builds/ 安装了clang Visual Studio 工具链。 使用 VS2013,我在编译任何 c++ 头文件时都会遇到几个错误。 例如:
#include <memory>
int main()
{
return 0;
}
这些错误似乎与 microsofts c++14 implementation 有关。 这在 Visual Studio 2012 中不会发生。 在 VS2013 中切换到工具链 LLVM-vs2012 也可以
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.
在命令行输出上运行clang -v
clang version 3.4 (195641)
Target: i686-pc-win32
Thread model: posix
你们中的任何人都可以重现此错误吗?如果是,我会在http://llvm.org/bugs/ 创建一个错误报告。
【问题讨论】:
标签: c++ visual-studio-2012 clang visual-studio-2013