Ad

How To Write "include Path(folder That Contain Header)" For IntelliSense Configurations In VS Code

- 1 answer

the directory of the header is C:\MinGW\include\stdio.h. How can I convert it to the path

Ad

Answer

To do this in VS Code, first use the command Ctrl + Shift + P to pull up the Command Pallette. Then, type in the command C/C++: Edit Configurations (UI). This will pull up a json file in which you can include paths to header files to be included for IntelliSense. The json should look something like this:

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "10.0.17763.0",
            "compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "msvc-x64"
        }
    ],
    "version": 4
}

To add a custom path, according to the jsonreference, you can specify another path under the "includePath property. Here is what you should change this json property to, according to your custom header's location:

"includePath": [
                "${workspaceFolder}/**",
                "C:/MinGW/include/"
            ],

Note that I did not include the actual header file, as the path must point to a folder that contains the header file rather than to the header itself. Also notice that you must use forward slashes rather than back slashes.

Ad
source: stackoverflow.com
Ad