-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
Feature: ConfigurationAn issue related to configuring the extension or IntelliSenseAn issue related to configuring the extension or IntelliSenseLanguage ServicebugfixedCheck the Milestone for the release in which the fix is or will be available.Check the Milestone for the release in which the fix is or will be available.regressionA bug that didn't exist in a previous releaseA bug that didn't exist in a previous release
Milestone
Description
Environment
- OS and Version: Ubuntu 22.04.4 LTS
- VS Code Version: 1.100.2
- C/C++ Extension Version: 1.25.3
Bug Summary and Steps to Reproduce
Bug Summary
The -iquote
option is not understood by the language service if that comes after an -isystem
option, resulting in "#include errors detected" errors.
Additional info
- Downgrade to an older version (tried with 1.23.5) seems to fix the issue.
- Ordering the compiler include path options so that
-iquote
comes before-isystem
results in expected behavior.
Steps to reproduce
In a workspace hierarchy as:
$ find . -type f
./.vscode/c_cpp_properties.json
./cpptools_bug_mwe.cpp
./foo/foo.hpp
./compile_commands.json
./bar/bar.hpp
with cpptools_bug_mwe.cpp
as:
#include "foo.hpp" // in foo/foo.hpp
#include <bar.hpp> // in bar/bar.hpp
int main()
{
return 0;
}
with .vscode/c_cpp_properties.json
as:
{
"configurations": [
{
"name": "Linux",
"compileCommands": ["${workspaceFolder}/compile_commands.json"]
}
],
"version": 4
}
and compile_commands.json
as:
[
{
"directory": "<path to ws root>",
"command": "cc -isystem bar -iquote foo cpptools_bug_mwe.cpp -o cpptools_bug_mwe.out",
"file": "cpptools_bug_mwe.cpp",
"output": "cpptools_bug_mwe.out"
}
]
you get:
and the following output from "C/C++ Log Diagnostics": cpp_diagnostics_fail.txt
Expected behavior
When ordering the compiler include options with -iquote
before -isystem
, i.e., with compile_commands.json
as:
[
{
"directory": "<path to ws root>",
"command": "cc -iquote foo -isystem bar cpptools_bug_mwe.cpp -o cpptools_bug_mwe.out",
"file": "cpptools_bug_mwe.cpp",
"output": "cpptools_bug_mwe.out"
}
]
the expected behavior i.e. no include errors is obtained, with the following output from "C/C++ Log Diagnostics": cpp_diagnostics_ok.txt
Configuration and Logs
---------------------- c_cpp_properties.json ----------------------
{
"configurations": [
{
"name": "Linux",
"compileCommands": ["${workspaceFolder}/compile_commands.json"]
}
],
"version": 4
}
---------------------- compile_commands.json ----------------------
[
{
"directory": "/home/dev/misc/cpptools_bug_mwe",
"command": "cc -isystem bar -iquote foo cpptools_bug_mwe.cpp -o cpptools_bug_mwe.out",
"file": "cpptools_bug_mwe.cpp",
"output": "cpptools_bug_mwe.out"
}
]
---------------------- C/C++: Log Diagnostics ----------------------
-------- Diagnostics - 5/26/2025, 7:49:44 PM
Version: 1.25.3
Current Configuration:
{
"name": "Linux",
"compileCommands": [
"/home/dev/misc/cpptools_bug_mwe/compile_commands.json"
],
"compilerPathIsExplicit": false,
"cStandardIsExplicit": false,
"cppStandardIsExplicit": false,
"intelliSenseModeIsExplicit": false,
"recursiveIncludesReduceIsExplicit": false,
"recursiveIncludesPriorityIsExplicit": false,
"recursiveIncludesOrderIsExplicit": false,
"compileCommandsInCppPropertiesJson": [
"${workspaceFolder}/compile_commands.json"
],
"mergeConfigurations": false,
"recursiveIncludes": {},
"browse": {
"limitSymbolsToIncludedHeaders": true
}
}
Additional Tracked Settings:
{
"editorTabSize": 4,
"editorInsertSpaces": true,
"editorAutoClosingBrackets": "languageDefined",
"filesEncoding": "utf8",
"filesAssociations": {},
"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.25.3.0
Current database path: /home/dev/.cache/vscode-cpptools/6f7add48ab2294ba00d1a991fbc0d457/.browse.VC.db
Translation Unit Mappings:
[ /home/dev/misc/cpptools_bug_mwe/cpptools_bug_mwe.cpp - source TU]:
Translation Unit Configurations:
[ /home/dev/misc/cpptools_bug_mwe/cpptools_bug_mwe.cpp ]
Process ID: 451790
Memory Usage: 18 MB
Compiler Path: /usr/bin/cc
Include paths:
system include (isystem): /home/dev/misc/cpptools_bug_mwe/bar
system include: /usr/include/c++/11
system include: /usr/include/x86_64-linux-gnu/c++/11
system include: /usr/include/c++/11/backward
system include: /usr/lib/gcc/x86_64-linux-gnu/11/include
system include: /usr/local/include
system include: /usr/include/x86_64-linux-gnu
system include: /usr/include
Standard Version: c++17
IntelliSense Mode: linux-gcc-x64
Other Flags:
--g++
--gnu_version=110400
compile_commands.json entry:
directory: /home/dev/misc/cpptools_bug_mwe
file: /home/dev/misc/cpptools_bug_mwe/cpptools_bug_mwe.cpp
command: cc -isystem bar -iquote foo cpptools_bug_mwe.cpp -o cpptools_bug_mwe.out
output: cpptools_bug_mwe.out
Total Memory Usage: 18 MB
Browse Paths from compile_commands.json, from workspace folder: /home/dev/misc/cpptools_bug_mwe
/home/dev/misc/cpptools_bug_mwe
/home/dev/misc/cpptools_bug_mwe/bar
/home/dev/misc/cpptools_bug_mwe/foo
/usr/include
/usr/include/c++/11
/usr/include/c++/11/backward
/usr/include/x86_64-linux-gnu
/usr/include/x86_64-linux-gnu/c++/11
/usr/lib/gcc/x86_64-linux-gnu/11/include
/usr/local/include
------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 4844
Other Extensions
No response
Additional context
No response
Metadata
Metadata
Assignees
Labels
Feature: ConfigurationAn issue related to configuring the extension or IntelliSenseAn issue related to configuring the extension or IntelliSenseLanguage ServicebugfixedCheck the Milestone for the release in which the fix is or will be available.Check the Milestone for the release in which the fix is or will be available.regressionA bug that didn't exist in a previous releaseA bug that didn't exist in a previous release
Type
Projects
Status
Done