When working with C or C++ projects in Visual Studio Code (VSCode), you may encounter the warning: #include errors detected. Please update your includePath.
This error typically appears when the IDE’s IntelliSense system—used for code navigation, autocompletion, and syntax checking—fails to locate the header files referenced by #include
statements. Without resolving this issue, VSCode may not recognize even standard headers like <iostream>
or <vector>
, making development cumbersome.

Why This Error Happens
The root cause is usually that VSCode’s C/C++ extension cannot find the directories where your header files are stored. This can result from:
- Missing or misconfigured compiler paths
- Incorrect or incomplete
includePath
settings in your project’s configuration - Third-party libraries not being referenced properly
To fix this, you’ll need to ensure your development environment is correctly configured, including installing the appropriate compiler and defining where VSCode should look for headers.
Step 1: Verify Your Development Environment
Start by ensuring that your system has the necessary compiler and tools installed. Without a compiler, IntelliSense can’t detect or resolve standard system headers.
Here’s what to check depending on your operating system:
Install the C/C++ Extension for VSCode
- This is required for IntelliSense to function. Open the Extensions view (Ctrl+Shift+X) and install the Microsoft extension named
C/C++ (ms-vscode.cpptools)
.
Install a C/C++ Compiler
- The compiler provides the standard headers and libraries. Platform Installation Method Windows Install MinGW or Visual Studio with MSVC macOS Run
xcode-select --install
andbrew install gcc
Linux Runsudo apt install build-essential
(Debian/Ubuntu) or equivalent for other distros
Once installed, ensure the compiler is accessible via your system’s PATH
.
Step 2: Update the includePath
in VSCode Configuration
Now that your environment is set up, configure VSCode to recognize where your header files reside.
This is done in the .vscode/c_cpp_properties.json
file. You can open it via:
- Pressing
Ctrl+Shift+P
- Typing C/C++: Edit Configurations (UI)
- Selecting your active configuration
Depending on your platform, here’s how to set it up:
For Linux
{
"includePath": [
"${workspaceFolder}/**",
"/usr/include",
"/usr/local/include"
],
"compilerPath": "/usr/bin/g++",
"intelliSenseMode": "linux-gcc-x64"
}
For Windows (MinGW)
{
"includePath": [
"${workspaceFolder}/**",
"C:/MinGW/lib/gcc/<version>/include/c++"
],
"compilerPath": "C:/MinGW/bin/g++.exe",
"intelliSenseMode": "gcc-x64"
}
Replace <version>
with your actual installed version (e.g., 9.2.0
).
For macOS
{
"includePath": [
"${workspaceFolder}/**",
"/usr/local/include"
],
"compilerPath": "/usr/bin/clang++",
"intelliSenseMode": "macos-clang-x64"
}
Key Configuration Fields
Understanding each field helps in troubleshooting:
includePath
: Tells IntelliSense where to look for header filescompilerPath
: Points to your system’s compiler, which allows VSCode to auto-detect standard system includesintelliSenseMode
: Must match the selected compiler (e.g.,linux-gcc-x64
,macos-clang-x64
, ormsvc-x64
)
Step 3: Use Quick Fix for Missing Includes
If you’re working with custom or third-party headers, VSCode might not detect them automatically. When you see a red squiggle under a #include
, you can:
- Hover your cursor over the squiggled line
- Click the lightbulb icon that appears
- Choose Add to includePath
This action will append the detected path directly into your c_cpp_properties.json
file, solving the issue without manual editing.
Step 4: Switch to Tag Parser (Optional Fallback)
If IntelliSense still doesn’t work despite correct paths, you can temporarily fall back to VSCode’s basic Tag Parser mode.
This won’t offer full autocomplete or error detection but can restore minimal functionality.
To enable:
- Go to VSCode Settings (Ctrl+,)
- Search for
C_Cpp.intelliSenseEngine
- Set it to
Tag Parser
Or update your .vscode/settings.json
:
{
"C_Cpp.intelliSenseEngine": "Tag Parser"
}
Note: This is a workaround, not a fix. Prefer restoring full IntelliSense whenever possible.
Step 5: Restart VSCode and Validate Configuration
After making your changes:
- Restart VSCode to reload your workspace and settings
- Optionally rebuild your project if needed
To verify everything is working:
- Header files should no longer be marked with errors
- IntelliSense should autocomplete standard library functions and types
If issues persist, try running C/C++: Log Diagnostics from the Command Palette for deeper troubleshooting.
Final Thoughts
Resolving the #include errors detected. Please update your includePath
warning in Visual Studio Code is mostly a matter of ensuring your compiler is properly installed and pointing VSCode to the right header directories. By configuring your environment step by step—starting from compiler installation to fine-tuning include paths—you’ll restore IntelliSense capabilities and streamline your C/C++ development workflow.
Read More: