microsoft / microsoft/vscode-cpptools

includePath doesn't work but when I forceInclude all intelsense error are gone

Open
#13,445 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Feature: Configuration Language Service
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Environment
  • OS and Version: Fedora 41
  • VS Code Version: c++
  • C/C++ Extension Version: latest
  • If using SSH remote, specify OS of remote machine:
Bug Summary and Steps to Reproduce

Bug Summary:

Image
this is the error

    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/bpf/**",
                "${workspaceFolder}/bpf/include"
            ],
            "forcedInclude": [
                // "${workspaceFolder}/bpf/include/type_mapper.h"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/gcc",
            "cStandard": "c17",
            "cppStandard": "c++98",
            "intelliSenseMode": "linux-gcc-x64"
        }
    ],
    "version": 4
}

the errors goes away only if I use forceInclude

  "forcedInclude": [
                "${workspaceFolder}/bpf/include/type_mapper.h"
            ],

why I have to forceInclude there is a lot of projects & a lot of files it's not possible to force include each and every file.
Steps to reproduce:

install fedora 41 vs code & c++ extension
repo: https://github.com/cilium/tetragon

Expected behavior:
there should be 0 intelsense errors

Configuration and Logs
c_cpp_properties.json


{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/bpf/**",
                "${workspaceFolder}/bpf/include"
            ],
            "forcedInclude": [
                // "${workspaceFolder}/bpf/include/type_mapper.h"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/gcc",
            "cStandard": "c17",
            "cppStandard": "c++98",
            "intelliSenseMode": "linux-gcc-x64"
        }
    ],
    "version": 4
}



C/C++: Log Diagonstics
-------- Diagnostics - 4/2/2025, 1:49:50 AM
Version: 1.23.6
Current Configuration:
{
    "name": "Linux",
    "includePath": [
        "/home/malvee/code/tetragon/bpf/**",
        "/home/malvee/code/tetragon/bpf/include"
    ],
    "forcedInclude": [],
    "defines": [],
    "compilerPath": "/usr/bin/gcc",
    "cStandard": "c17",
    "cppStandard": "c++98",
    "intelliSenseMode": "linux-gcc-x64",
    "compilerPathIsExplicit": true,
    "cStandardIsExplicit": true,
    "cppStandardIsExplicit": true,
    "intelliSenseModeIsExplicit": true,
    "compilerPathInCppPropertiesJson": "/usr/bin/gcc",
    "mergeConfigurations": false,
    "browse": {
        "path": [
            "/home/malvee/code/tetragon/bpf/**",
            "/home/malvee/code/tetragon/bpf/include",
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
Modified Settings:
{
    "C_Cpp.errorSquiggles": "enabled",
    "C_Cpp.default.compilerPath": "/usr/bin/gcc"
}
Additional Tracked Settings:
{
    "editorTabSize": 2,
    "editorInsertSpaces": true,
    "editorAutoClosingBrackets": "languageDefined",
    "filesEncoding": "utf8",
    "filesAssociations": {
        "*.css": "tailwindcss"
    },
    "filesExclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/.DS_Store": true,
        "**/Thumbs.db": true
    },
    "filesAutoSaveAfterDelay": false,
    "editorInlayHintsEnabled": true,
    "editorParameterHintsEnabled": true,
    "searchExclude": {
        "**/node_modules": true,
        "**/bower_components": true,
        "**/*.code-search": true
    },
    "workbenchSettingsEditor": "ui"
}
cpptools version (native): 1.23.6.0
Current database path: /home/malvee/.cache/vscode-cpptools/584948c031d850a2bd45203b3ed0aa43/.browse.VC.db
Translation Unit Mappings:
[ /home/malvee/code/tetragon/bpf/process/bpf_enforcer.c - source TU]:
    /home/malvee/code/tetragon/bpf/process/bpf_enforcer.h
Translation Unit Configurations:
[ /home/malvee/code/tetragon/bpf/process/bpf_enforcer.c ]
    Process ID: 83170
    Memory Usage: 18 MB
    Compiler Path: /usr/bin/gcc
    Includes:
        /home/malvee/code/tetragon/bpf/include
        /home/malvee/code/tetragon/bpf/lib
        /home/malvee/code/tetragon/bpf/libbpf
    System Includes:
        /usr/lib/gcc/x86_64-redhat-linux/14/include
        /usr/local/include
        /usr/include
    Standard Version: c17
    IntelliSense Mode: linux-gcc-x64
    Other Flags:
        --gcc
        --gnu_version=140201
Total Memory Usage: 18 MB

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 24382


Other Extensions

No response

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the c_cpp_properties.json configuration and the diagnostics for bpf/process/bpf_enforcer.c, then inspect how includePath and forcedInclude are applied to that translation unit. Compare the discovered includes with bpf/include/type_mapper.h and reproduce against the cilium/tetragon repository on Fedora 41. Done means the reported IntelliSense errors are resolved without forcing each header.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.