Я пытаюсь настроить среду vscode на моей Ma c. Я следую процедуре на сайте https://code.visualstudio.com/docs/cpp/config-clang-mac Но когда я пытаюсь отладить свою программу, она показывает ошибку и не может перешагнуть. Я не уверен, что это из-за версии или чего-то в этом роде.
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
vector<string> msg {"Hello", "C++++", "World", "from", "VS Code", "and the C++ extension!"};
for (const string& word : msg)
{
cout << word << " ";
}
vector<string> aaa {"H", "E", "L", "L", "O"};
for (const string& word : aaa)
{
cout << word << " ";
}
cout << endl;
}
И сообщение об ошибке показывает
ожидаемо; в конце декларации [9, 23] ожидаем; в конце объявления [16, 23] диапазон на основе l oop - расширение c ++ 11 [11, 29] диапазон на основе l oop - расширение c ++ 11 [17, 29]
Мой запуск. json файл
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
// "name": "(lldb) Launch",
"name": "clang++ - Build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [],
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "lldb",
"preLaunchTask": "clang++ build active file"
}
]
}
Моя задача. json файл
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "clang++ build active file",
"command": "/usr/bin/clang++",
"args": [
"-std=c++17",
"-stdlib=libc++",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}