How do I use c++ 26 with gcc 13.2.0?

146 views Asked by At
{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "cppbuild",
            "label": "build with g++ 13.2.0",
            "command": "C:\\Users\\Student\\Downloads\\mingw64\\bin\\g++.exe",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "-std=c++2b",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": "build",
            "detail": "compiler: \"C:\\Users\\Student\\Downloads\\mingw64\\bin\\g++.exe\""
        }
    ]
}

using -std=c++2b only allows me to use c++ 23 and i could only find C++ 20 ones online, can someone help me use c++ 26 and help me understand why you use that(whatever you type to use C++26) and not C++26 for example?

i tried using "-std=c++26", like you do when u use c++ 20 but instead i got an error.

2

There are 2 answers

0
starball On

You... don't? https://en.cppreference.com/w/cpp/compiler_support shows that little to no C++26 support is available in GCC 13. Much is in GCC 14, but even that isn't complete.

1
Wutz On

You have to use c++2c, it's the what they use for preliminary C++26 support. Basically until it's properly standardized, then you'll be able to use c++26. See: https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html