-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Environment
- OS and Version:
Edition Windows 11 Home
Version 23H2
Installed on 01/10/2022
OS build 22631.3880
Experience Windows Feature Experience Pack 1000.22700.1020.0
- VS Code Version:
Version: 1.91.1 (user setup)
Commit: f1e16e1e6214d7c44d078b1f0607b2388f29d729
Date: 2024-07-09T22:06:49.809Z
Electron: 29.4.0
ElectronBuildId: 9728852
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Windows_NT x64 10.0.22631
- C/C++ Extension Version:
v1.21.3
Bug Summary and Steps to Reproduce
Bug Summary:
Cpp Tools indexes MSVC compiler from Visual Studio 2022 even though it is not specified anywhere in configuration, resulting in multiple errors like below:
Error while processing S:\Code\CPP\monoshot\src\render_interface_test\main.cpp.
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\cassert:9:10: error: 'assert.h' file not found [clang-diagnostic-error]
9 | #include <assert.h>
| ^~~~~~~~~~
Steps to reproduce:
- Install Cpp Tools, CMake Tools, use configuration below.
- Open some random C++ file or project.
- Watch intellisense provide errors like above.
Expected behavior:
Intellisense does not show errors like:
Error while processingC/C++(clang-diagnostic-error)
cassert(9, 10): 'assert.h' file not found
Configuration and Logs
`c_cpp_properties.json`:
{
"configurations": [
{
"name": "CMake",
"compileCommands": "${config:cmake.buildDirectory}/compile_commands.json",
"configurationProvider": "ms-vscode.cmake-tools",
"cppStandard": "c++20"
}
],
"version": 4
}
debug output from C/C++ extension
:
(in comment, because I reached 65536 character limit)
(appears in project: https://github.com/vis4rd/monoshot/tree/renderer-refactor, but imo shoult be reproducible in any c++ code)
settings.json
:
"C_Cpp.autoAddFileAssociations": false,
"C_Cpp.codeAnalysis.clangTidy.enabled": true,
"C_Cpp.codeAnalysis.clangTidy.useBuildPath": true,
"C_Cpp.debugShortcut": false,
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
"C_Cpp.default.cppStandard": "c++20",
"C_Cpp.intelliSenseCachePath": "${workspaceFolder}/.cache/vscode-cpptools",
"C_Cpp.intelliSenseEngine": "default",
"C_Cpp.intelliSenseEngineFallback": "enabled",
"C_Cpp.loggingLevel": "Debug",
"C_Cpp.markdownInComments": "enabled",
"C_Cpp.preferredPathSeparator": "Forward Slash",
"C_Cpp.refactoring.includeHeader": "never",
"cmake.buildBeforeRun": false,
"cmake.configureOnEdit": false,
"cmake.configureOnOpen": false,
"cmake.languageSupport.enableFileAPI": true,
Issue is reproducible even when no c_cpp_properties.json
exists, however I created it just to check if it changes anything (it does not) and for the sake of this issue.
Used compiler in CMake is different than default Visual Studio one:
PS S:\Code\CPP\monoshot> S:\Environment\Compilers\mingw64_11.0.0_gcc_13.1.0_clang_16.0.5_msvcrt\bin\g++.exe --version
g++.exe (MinGW-W64 x86_64-msvcrt-posix-seh, built by Brecht Sanders) 13.1.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
But for some reason these includes are indexed (snippet from above LSP log):
Folder: C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.33.31629\ATLMFC\INCLUDE\* will be indexed
Folder: C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.33.31629\INCLUDE\* will be indexed
..I think they are causing this issue of "clang-diagnostic-error" - they have precedence over correct include paths from selected compiler.
Other Extensions
ms-dotnettools.vscode-dotnet-runtime
ms-vscode.cpptools
ms-vscode.cmake-tools
...and many others that I don't think they could influence this behavior
Additional context
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status