问题
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/.
回答1:
The bug is being tracked here: http://llvm.org/bugs/show_bug.cgi?id=17926
See the comment section for further info.
来源:https://stackoverflow.com/questions/20579216/clangvs2013-error-when-including-c-header-vs2012working