microsoft / microsoft/vscode-cpptools
Incorrect intelliSense errors depending on include order
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- TypeScript
- Estrellas
- 6.2k
- Forks
- 1.7k
- Merge medio
- 14 h 46 min
- PR fusionados (30 d)
- 61
Descripción
Bug type: Language Service
Describe the bug
- OS and Version: Windows 10 21H2
- VS Code Version: 1.68.1
- C/C++ Extension Version: 1.10.7
- A clear and concise description of what the bug is, including information about the workspace (i.e. is the workspace a single project or multiple projects, size of the project, etc).
I've got the following two files, using IAR Systems standard library headers:
// main.cpp
#include <stdint.h>
#include <wchar.h>
#include <memory>
#include "header.hpp"
int main() {
auto b = ns::B(1);
}
// header.hpp
#pragma once
namespace ns {
class B {
public:
explicit B(const int& a) {}
};
}
In main.cpp, intelliSense incorrectly complains that the namespace ns does not exist:

If I open header.hpp, where ns is defined, and go back to main.cpp, the error disappears for a while. If I browse some other files for a while, the error reappears.
Interestingly, the problem only occurs when <memory> is included last of the standard library headers. Removing any of the includes or including <memory> earlier gets rid of the intelliSense error. main.cpp compiles correctly in all cases.
Steps to reproduce
Here is an example that reproduces the problem:
cpptools_errors_from_include_order_example.zip
It includes all the necessary files, including the c_cpp_properties.json and all required IAR standard library headers.
Simply open main.cpp and observe the intelliSense error.
Additional context
This may be related to https://github.com/microsoft/vscode-cpptools/issues/9170. The symptoms are similar, but the workaround of disabling the cache size limit did not work for me.
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Abre el archivo cpptools_errors_from_include_order_example.zip proporcionado e inspecciona main.cpp, header.hpp, c_cpp_properties.json y los encabezados de IAR; empieza reproduciendo el falso error de ns con incluido en último lugar. Se considera terminado cuando IntelliSense ya no informe de que ns no existe para el ejemplo proporcionado, mientras el proyecto sigue compilándose correctamente.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- cpp, typescript, vscode
- Área
- developer-experience, devtools
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100