0

I am trying to learn C++ on my own and I've just started, so please do not judge me.

I used the auto keyword in VSCode. In the Settings menu, I set C_Cpp > Default:Cpp Standard to C++11, but I still get this warning:

'auto' type specifier is a C++11 extension [-Wc++11-extensions].

I had already installed fundamental extensions, and also looked at other relevant questions about it, and could not find an answer.

Can someone help me?

(By the way, I am using MacOS if it makes sense...)

  • 1
    How are you building the code? Is the warning coming from intellisense or the compiler? – Alan Birtles Sep 08 '20 at 18:51
  • You might need to add a flag something like: XXX`_CXXFLAGs = -Wno-c++11-extensions` to the compiler or intellisense – Ranoiaetep Sep 08 '20 at 18:53
  • Unrelated: If you have not already loaded up on books, I highly recommend browsing [Stack Overflow's curated list of C++ learning resources](https://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list). C++ can be learned solo, but good reference material will speed the process greatly. The Internet cannot be safely used until you have enough of a language background to tell when you've stumbled into a bad tutorial. – user4581301 Sep 08 '20 at 19:23
  • The warning is coming from the compiler. I also tried compiling the code by inserting "g++ -std=c++17 -g main.cpp -o main" or so, other thing I tried is adding ["-std=c++14"] item to Clang:cxxflags on Settings menu (also c++11, c++17...). Using ["-std=c++14"] item also did not work since it gives me a message "clang: error: no such file or directory: '["-std=c++14"]'". The error still remains. Sorry If i am trying weird ways... By the way, thanks for your source recommendation, now I am checking it too. – Hungrymeow Sep 08 '20 at 19:28

0 Answers0