Da3eeef's blog

By Da3eeef, history, 13 months ago, In English

I've got a new m1 macbook air, but some things not working on vs code, like using auto or for each loop, it's showing

warning: range-based for loop is a C++11 extension [-Wc++11-extensions]

I know that error occurs because of the old selected c++ compiler on vs code, but I changed the version from the setting and tried so hard, and it's not working.

I'm wondering if some had the same issue.

(everything is working fine on xCode)

  • Vote: I like it
  • +3
  • Vote: I do not like it

»
13 months ago, # |
  Vote: I like it 0 Vote: I do not like it

(everything is working fine on xCode)

then use xCode :)

  • »
    »
    13 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Why post blog from your alt, and then comment from main? lol

»
13 months ago, # |
  Vote: I like it 0 Vote: I do not like it

In VS Code settings search for "C++ standard". Select c++20 or c++17

»
13 months ago, # |
  Vote: I like it +5 Vote: I do not like it
  • Press CMD + P and search settings.json.
  • Go to the "code-runner.executorMap": section.
  • For "cpp", write -std=c++17 after whichever compiler you are using.
Like this