0
 warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
        for(auto &t : remove){
            ^

range-based for loop is a C++11 extension [-Wc++11-extensions]
        for(auto &t : remove){
                    ^
9 warnings and 7 errors generated.

I am facing this error. I guess I have some error in the compiler path or something, but I can't figure it out. Clang or GCC. I am sick of it. Can anyone please help me out?

Below are my .json files

OS-> Mac , Vscode, code runner, c/c++

I guess i have changed some paths or something in terminal , gcc -v shows clang 13.1.6

c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Mac",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [],
            "macFrameworkPath": [],
            "compilerPath": "/usr/bin/clang",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "macos-clang-arm64"
        }
    ],
    "version": 4
}

launch.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": []
}

task.json

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: clang++ build active file",
            "command": "/usr/bin/clang++",
            "args": [
                "-std=c++17",
                "-stdlib=libc++",
                "-Wno-conversion",
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}

Please help me to figure it out.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
  • See also: [How to enable C++17 support in VSCode C++ Extension](https://stackoverflow.com/questions/49397233/how-to-enable-c17-support-in-vscode-c-extension). Do the same steps but do them for C++11 instead of C++17. – Jason Sep 20 '22 at 05:02

0 Answers0