microsoft / microsoft/vscode-cmake-tools
IntelliSense complains about standard types when using precompiled headers v2
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.7k
- Forks
- 546
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 32
Description
Brief Issue Summary
My issue is the same as #1141
When enabling precompiled headers the editor fails to find system include files like "". It still finds and properly shows a project specific include file (my_class.h).
The red squiggles over the include show "#include errors detected based on information provided by the configurationProvider setting. Squiggles are disabled for this translation unit (/Users/kuikka/dev/include_problem/main.cpp). C/C++(1696"
App to repro: https://github.com/kuikka/include_problem
I have two cmake presets because at first I thought using vcpkg toolchain file was the issue but that turned out not to be the case.
CMake Tools Diagnostics
{
"os": "darwin",
"vscodeVersion": "1.85.0",
"cmtVersion": "1.16.32",
"configurations": [
{
"folder": "/Users/kuikka/dev/include_problem",
"cmakeVersion": "3.28.0",
"configured": true,
"generator": "Ninja",
"usesPresets": true,
"compilers": {
"CXX": "/Library/Developer/CommandLineTools/usr/bin/c++"
}
}
],
"cpptoolsIntegration": {
"isReady": true,
"hasCodeModel": true,
"activeBuildType": "Debug",
"buildTypesSeen": [
"Debug"
],
"requests": [
"file:///Users/kuikka/dev/include_problem/main.cpp"
],
"responses": [
{
"uri": "file:///Users/kuikka/dev/include_problem/main.cpp",
"configuration": {
"includePath": [
"/users/kuikka/dev/include_problem"
],
"defines": [],
"compilerPath": "/library/developer/commandlinetools/usr/bin/c++",
"compilerArgs": [],
"compilerFragments": [
"-g -std=gnu++20 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk",
"-Winvalid-pch -Xarch_arm64 -include/Users/kuikka/dev/include_problem/out/build/auto/CMakeFiles/app.dir/cmake_pch_arm64.hxx"
]
}
}
],
"partialMatches": [],
"targetCount": 1,
"executablesCount": 1,
"librariesCount": 0,
"targets": [
{
"name": "app",
"type": "EXECUTABLE"
}
]
},
"settings": [
{
"communicationMode": "automatic",
"useCMakePresets": "auto",
"configureOnOpen": null
}
]
}
Debug Log
[main] Building folder: include_problem
[main] Saving open files before configure/build
[build] Starting build
[driver] Start build
[proc] Executing command: /opt/homebrew/bin/cmake --build /Users/kuikka/dev/include_problem/out/build/auto --parallel 18
[proc] with environment: {"COMMAND_MODE":"unix2003","ELECTRON_NO_ATTACH_CONSOLE":"1","HOME":"/Users/kuikka","HOMEBREW_CELLAR":"/opt/homebrew/Cellar","HOMEBREW_PREFIX":"/opt/homebrew","HOMEBREW_REPOSITORY":"/opt/homebrew","INFOPATH":"/opt/homebrew/share/info:","LANG":"en_US.UTF-8","LOGNAME":"kuikka","LaunchInstanceID":"E6C5A60B-9A93-4835-AF4A-1744E26A1AD5","MANPATH":"/opt/homebrew/share/man::","MallocNanoZone":"0","ORIGINAL_XDG_CURRENT_DESKTOP":"undefined","PATH":"/Users/kuikka/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin","PWD":"/Users/kuikka/dev/include_problem","SECURITYSESSIONID":"186ab","SHELL":"/bin/zsh","SHLVL":"2","SSH_AUTH_SOCK":"/private/tmp/com.apple.launchd.Ekcl0Gz8S1/Listeners","TERM":"xterm-256color","TERM_PROGRAM":"Apple_Terminal","TERM_PROGRAM_VERSION":"452","TERM_SESSION_ID":"92ABA56B-41C8-45B9-B37F-86A262406E84","TMPDIR":"/var/folders/1q/rf0gp35574j60mdqlsnc812r0000gn/T/","USER":"kuikka","VCPKG_CHAINLOAD_TOOLCHAIN_FILE":"/Users/kuikka/dev/blubridge/toolchain.cmake","VSCODE_AMD_ENTRYPOINT":"vs/workbench/api/node/extensionHostProcess","VSCODE_CLI":"1","VSCODE_CODE_CACHE_PATH":"/Users/kuikka/Library/Application Support/Code/CachedData/af28b32d7e553898b2a91af498b1fb666fdebe0c","VSCODE_CRASH_REPORTER_PROCESS_TYPE":"extensionHost","VSCODE_CWD":"/Users/kuikka/dev/include_problem","VSCODE_HANDLES_UNCAUGHT_ERRORS":"true","VSCODE_IPC_HOOK":"/Users/kuikka/Library/Application Support/Code/1.85-main.sock","VSCODE_NLS_CONFIG":"{\"locale\":\"en-us\",\"osLocale\":\"en-us\",\"availableLanguages\":{},\"_languagePackSupport\":true}","VSCODE_PID":"48735","XPC_FLAGS":"0x0","XPC_SERVICE_NAME":"application.com.microsoft.VSCode.936824.936830.F1F59718-2255-480C-A7FF-11921541B85D","__CFBundleIdentifier":"com.microsoft.VSCode","__CF_USER_TEXT_ENCODING":"0x1F5:0x0:0x0","ELECTRON_RUN_AS_NODE":"1","APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL":"1","VSCODE_L10N_BUNDLE_LOCATION":""}
[build] ninja: no work to do.
[driver] Build completed: 00:00:00.015
[cmakefileapi-parser] Read reply folder: /Users/kuikka/dev/include_problem/out/build/auto/.cmake/api/v1/reply
[cmakefileapi-parser] Found index files: ["cache-v2-5a97157adac60b5541fe.json","cmakeFiles-v1-9c205ce199aebc6f8ae1.json","codemodel-v2-0e54b057b92de2481e81.json","directory-.-Debug-f5ebdc15457944623624.json","index-2023-12-18T02-40-08-0769.json","target-app-Debug-e0f048461da3ff26f10b.json","toolchains-v1-d12e1973b1325ca5064e.json"]
[build] Build finished with exit code 0
[cache] Reading CMake cache file /Users/kuikka/dev/include_problem/out/build/auto/CMakeCache.txt
[cache] Parsing CMake cache string
[extension] [4154] cmake.build finished (returned 0)
[cache] Reading CMake cache file /Users/kuikka/dev/include_problem/out/build/auto/CMakeCache.txt
[cache] Parsing CMake cache string
Additional Information
I first noticed this problem when I got my new MacBook , installed vs code on it and started working on my existing codebase.
I have not (and still do not) had this problem on my Windows 11 or Linux Ubuntu 22.04 development environments with the same code. My project uses vcpkg toolchain with cmake and vs code.
This Mac has Xcode 15, clang 15.0.0. Happy to provide more details.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked include_problem reproduction and the CMake Tools Diagnostics, focusing on the cpptoolsIntegration configuration for main.cpp and its compilerFragments. Verify the behavior with the reported macOS, CMake presets, and precompiled-header flags; done means standard headers such as no longer produce IntelliSense squiggles while project headers remain recognized.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp, vscode
- Domain
- build-system, developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100