Vscode-cpptools: mistake on identify include path

Created on 8 Mar 2018  路  5Comments  路  Source: microsoft/vscode-cpptools

  • Platform: ArchLinux
  • VS version: 1.20.1
  • C/C++ extension version: 0.15.0
  • Other extensions you installed and if the issue persists after disabling them: 'C/C++ Clang Command Adapter(disabled, but the issue still present)', 'C++ Intellisense(disabled, but the issue still present)'
  • step-by-step instructions to reproduce the issue: I open a project with comments like the following, and the the extension mark it as an include error. But I don't know how to reproduce it in a simple project. It just happens. I'm sorry.
    screenshot_20180308_145310
  • Any log messages present in the Output window (use "C_Cpp.loggingLevel": "Information" in settings.json)
    screenshot_20180308_145604
Language Service by design question

Most helpful comment

Let's say you open "foo.h" which is included by "foo.cpp". Our engine detects that foo.h is included by foo.cpp and we start an IntelliSense server for foo.cpp. Let's say that foo.cpp also includes "bar.h", but the includePath is not set up and we can't find bar.h. In this case foo.cpp has an "include error" and our policy is to disable squiggles for the whole translation unit (which consists of foo.cpp, foo.h and bar.h). Since foo.h doesn't have any include errors, but squiggles have been disabled for the whole translation unit, we put this message in foo.h so that you will know why you are not getting the full IntelliSense experience.

To resolve the issue, you need to open the .cpp file shown in the message and resolve the "include errors". If the missing header files are in your workspace folder, you should be able to resolve the errors by clicking on the green squiggle, then clicking the lightbulb icon that appears to get some suggestions of what to do.

This document has more information about configuring your include path.

All 5 comments

When you open a header file, we attempt to identify a .cpp file that includes it so that we can compute IntelliSense with a more useful context. The error you are seeing is because the .cpp file we attached this header to has some include errors. If you open up the file that is redacted in your screenshot, you will see which #include error is causing the problem.

Can you give more detail to what you said? I can't figure out your point. Sorry.

Let's say you open "foo.h" which is included by "foo.cpp". Our engine detects that foo.h is included by foo.cpp and we start an IntelliSense server for foo.cpp. Let's say that foo.cpp also includes "bar.h", but the includePath is not set up and we can't find bar.h. In this case foo.cpp has an "include error" and our policy is to disable squiggles for the whole translation unit (which consists of foo.cpp, foo.h and bar.h). Since foo.h doesn't have any include errors, but squiggles have been disabled for the whole translation unit, we put this message in foo.h so that you will know why you are not getting the full IntelliSense experience.

To resolve the issue, you need to open the .cpp file shown in the message and resolve the "include errors". If the missing header files are in your workspace folder, you should be able to resolve the errors by clicking on the green squiggle, then clicking the lightbulb icon that appears to get some suggestions of what to do.

This document has more information about configuring your include path.

thank you, i will check it when it is Monday.

Closing this issue due to long inactivity.

Was this page helpful?
0 / 5 - 0 ratings