#Include Errors Detected in VScode

#include errors detected in vscode

The answer is here: How to use C/Cpp extension and add includepath to configurations.

Click the light bulb and then edit the JSON file which is opened. Choose the right block corresponding to your platform (there are Mac, Linux, Win32 – ms-vscode.cpptools version: 3). Update paths in includePath (matters if you compile with VS Code) or browse.paths (matters if you navigate with VS Code) or both.

Thanks to @Francesco Borzì, I will append his answer here:

You have to Left /kbd> click on the bulb next to the squiggled code line.

If a #include file or one of its dependencies cannot be found, you can also click on the red squiggles under the include statements to view suggestions for how to update your configuration.

Sample Image

#include errors detected based on information provided by the configurationProvider setting

You are trying to find file .../"maximum.h" which obviously in not existing.

Use either <maximum.h> which first will search your file inside compiler directories or "maximum.h" which first will search near your current file.

Visual Studio Code gives me #include error detected for C

I have found the solution thanks to this video on how to Set Up C++ Development With Visual Studio Code on Windows 10 (VS Code).

  1. I launched MinGW Installation Manager and installed all the package from the Basic Setup.

  2. I added the path of the gcc compiler to my system´s environment variables: C:\MinGW\bin, in which is the gcc.exe.

  3. I opened the c_cpp_properties.json file and added different paths for the folders I want to include. So now my c_cpp_properties.json file looks like this:

    {
    "configurations": [{
    "name": "Win32",
    "includePath": [
    "${workspaceFolder}/**",
    "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.10240.0\\ucrt",
    "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\include",
    "C:\\MinGW\\lib\\gcc\\mingw32\\6.3.0",
    "C:\\MinGW\\lib\\gcc\\mingw32\\6.3.0\\include\\c++",
    "C:\\MinGW\\lib\\gcc\\mingw32\\6.3.0\\include"
    ],
    "defines": ["_DEBUG", "UNICODE", "_UNICODE"],
    "intelliSenseMode": "clang-x64"
    }],
    "version": 4
    }


Related Topics



Leave a reply



Submit