Search code examples
c++visual-studio-codec++17string-view

Please update includepath error at #include <string_view>


I have the following configuration in c_cpp_properties.json:

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "browse": {
                "path": [
                    "C:/MinGW/lib/gcc/mingw32/6.3.0/include",
                    "C:/MinGW/lib/gcc/mingw32/6.3.0/include-fixed",
                    "C:/MinGW/include/*",
                    "${workspaceRoot}"
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            },
            "compilerPath": "C:/MinGW/bin/g++.exe",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "gcc-x64"
        }
    ],
    "version": 4
}

My C++ code is:

#include <string_view>

using namespace::std;

However, I get "There is #include error. Please update includePath". But I don't know how can I update it.


I am running this on VS Code.
GCC Version - 6.3.0
C++ Standard - c++17
Project structure:


Solution

    • This is for conclusion for this error! *
    1. Only GCC 7+ version can use <string_view>
    2. https://sourceforge.net/projects/mingw-w64/files/Multilib%20Toolchains%28Targetting%20Win32%20and%20Win64%29/ray_linn/gcc-9.x-with-ada/ does not support 7+ version gcc.
    3. However, if you search "MinGW gcc 9 version", you can find upgraded version mingw.
    4. After replace it with the old version mingw, you can use it.

    Really thank you for your comments! :-)