激活Clang中的c++ 11支持。

时间:2022-02-26 17:26:29

I've downloaded and built clang version 3.0 in order to play around a bit with C++11 features, however I get this error (even though I am using the -Wc++11-extensions flag).

我已经下载并构建了clang版本3.0,以便在c++11的特性上运行,但是我得到了这个错误(尽管我使用的是-Wc++11-extensions标志)。

S:\llvm\code>clang++.exe -Wc++11-extensions variadic.cpp
variadic.cpp:4:19: warning: variadic templates are a C++11 extension [-Wc++11-extensions]
template <typename... Args>

S:\ llvm \ >叮当声+ +代码。exe wc + + 11-extensions可变。cpp可变。cpp:4:19:警告:变量模板是一个c++11扩展名[-Wc+ 11-extensions]模板 …arg游戏>

I've built clang with VS10 on Windows 7 (64bit) and the build passed successfully.

我在Windows 7(64位)上使用VS10构建了clang,并且成功地通过了构建。


Edit: As @cli_hlt pointed out this is a warning not an error, the error is something I did not paste unable to execute command: program not executable. The root cause for that was that link.exe was not in the PATH. Once I ran from a VS command prompt all was well.

编辑:@cli_hlt指出这是一个警告,不是错误,错误是我没有粘贴不能执行命令的东西:程序不可执行。造成这一现象的根本原因是链接。exe不在路上。当我从VS命令提示符运行时,一切都很好。

1 个解决方案

#1


20  

You are getting a warning, not an error.

你得到的是警告,而不是错误。

The -W switch is used to enable compiler warnings. So for my understanding, by using -Wc++11-extensions you tell the compiler to warn you if you are using C++11 extensions.

-W开关用于启用编译器警告。因此,根据我的理解,通过使用-Wc++11扩展,您可以告诉编译器,如果您使用c++11扩展,就可以警告您。

And thats exactly what happens here.

这就是这里的情况。

#1


20  

You are getting a warning, not an error.

你得到的是警告,而不是错误。

The -W switch is used to enable compiler warnings. So for my understanding, by using -Wc++11-extensions you tell the compiler to warn you if you are using C++11 extensions.

-W开关用于启用编译器警告。因此,根据我的理解,通过使用-Wc++11扩展,您可以告诉编译器,如果您使用c++11扩展,就可以警告您。

And thats exactly what happens here.

这就是这里的情况。