Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Activating C++11 support in Clang

Tags:

c++

c++11

clang

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).

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>

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


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.

like image 373
Motti Avatar asked Oct 24 '11 11:10

Motti


People also ask

Does Clang support C ++ 11?

You can use Clang in C++11 mode with the -std=c++11 option. Clang's C++11 mode can be used with libc++ or with gcc's libstdc++.

What version of C does Clang use?

Clang 14, the latest major version of Clang as of March 2022, has full support for all published C++ standards up to C++17, implements most features of C++20, and has initial support for the upcoming C++23 standard.

Does Clang work for C?

The Clang tool is a front end compiler that is used to compile programming languages such as C++, C, Objective C++ and Objective C into machine code.


1 Answers

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.

And thats exactly what happens here.

like image 71
cli_hlt Avatar answered Nov 15 '22 22:11

cli_hlt