Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 97473

Visual Studio Code / and in Terminal - [-Wc++11-extensions] Error

$
0
0

This question has been asked a couple times and I followed the recommendations but I still have the problem. Here is the error:

Code:

#include <iostream>
using namespace std;


void test()
{

int v[]={0,1,2,3};

for(auto x:v)
    cout << x << '\n';
}

int main()
{

}

Error:

1p7.cpp:10:5: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
for(auto x:v)
    ^
1p7.cpp:10:11: warning: range-based for loop is a C++11 extension [-Wc++11-extensions]
for(auto x:v)
          ^
2 warnings generated.

I've changed the settings:

C_Cpp › Default: Cpp Standard to c++11

And it is still not working. I don't want this to work just for this code but in general so running something like

g++ -std=c++11 -g test.cpp

doesn't do much for me. It probably has something to do with the compiler but I've changed the compiler as well. I just reinstalled VS code and the C++ package. Still is not working. I tried this also via terminal and it shows the same two warnings without running g++ -std=c++11 -g test.cpp.

Any help is appreciated.

Edit:

Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 9.0.0 (clang-900.0.39.2)
Target: x86_64-apple-darwin16.7.0
Thread model: posix

Viewing all articles
Browse latest Browse all 97473

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>