Блог пользователя Da3eeef

Автор Da3eeef, история, 14 месяцев назад, По-английски

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)

  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится

»
14 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

(everything is working fine on xCode)

then use xCode :)

»
14 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

»
14 месяцев назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится
  • 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