根据http://clang.llvm.org/get_started.html ,我使用 Visual Studio 2010 在 Windows 上进行了 ALL_BUILD,并使用 $PATH=...ClangSourcBuildPath...\build\bin\ 将构建的东西添加到我的系统路径中发布
我现在可以在控制台上编译以下文件:
$> 铿锵文件_c.c
//file_c.c
#include <stdio.h>
int main()
{
printf("hello world\n");
return 0;
}
但是如果我对以下文件($> clang file_cpp.cpp)做同样的事情:
//file_cpp.cpp
#include <iostream>
int main()
{
std::cout << "Hello World!";
return 0;
}
我收到以下错误:
在 file_cpp.cpp:1 中包含的文件中:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\VC98\include\iostream:9:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\VC98\include\istream:9:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\VC98\include\ostream:9:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\VC98\include\ios:9:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\VC98\include\streambuf:9:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\VC98\include\xlocnum:13:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\VC98\include\xiosbase:9:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\VC98\include\xlocale:11:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\VC98\include\stdexcept:10:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\VC98\include\xstring:9:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\VC98\include\xmemory:15:
C:\Program Files (x86)\Microsoft Visual Studio\VC98\include\utility:81:10:
error: missing 'typename' prior to dependent type name '_It::iterator_category' typedef _It::iterator_category iterator_category;
C:\Program Files (x86)\Microsoft Visual Studio\VC98\include\utility:82:10:
error: missing 'typename' prior to dependent type name '_It::value_type' typedef _It::value_type value_type;
C:\Program Files (x86)\Microsoft Visual Studio\VC98\include\utility:83:10:
error: missing 'typename' prior to dependent type name '_It::distance_type' typedef _It::distance_type distance_type;
C:\Program Files (x86)\Microsoft Visual Studio\VC98\include\utility:224:32:
error: template parameter redefines default argument
template < class _E, class _Tr = char_traits< _E > >
...
我也试过:
$> clang++ file_cpp.cpp
$> clang -x c++ file_cpp.cpp
但我仍然得到同样的错误。
有人可以解释我怎么了?