vscode-docs icon indicating copy to clipboard operation
vscode-docs copied to clipboard

[C++] Include errors detected, cannot open source file "wchar.h" (dependency of "iostream")

Open zry9056 opened this issue 7 years ago • 3 comments

After following the steps in "Using Clang in Visual Studio Code" section, I ran into an include error when adding a source code file in the very first line "#include ". I tried editing c_cpp_properties.json file as stated in docs and deleting it entirely, but this errors does not go away. The error message goes like:

#include errors detected. Please update your includePath. IntelliSense features for this translation unit (projects/helloworld/helloworld.cpp) will be provided by the Tag Parser. cannot open source file "wchar.h" (dependency of "projects/helloworld/helloworld.cpp")

Any ideas on how to solve this issue?

zry9056 avatar Apr 17 '19 01:04 zry9056

@zry9056 is this the same wchar.h as the one in the C standard library, and is it in the default location? If so, are you seeing other headers? As a general rule, you should delete the "IncludePath" setting completely unless you have header files that are not in the standard locations or in your workspace folder.

mikeblome avatar Apr 19 '19 00:04 mikeblome

I've seen this intermittently as well, but have been unable to diagnose the issue. In general I feel it would be nice for users to get better insight into where Intellisense runs afoul when searching for headers. I often see a green squiggly in the copyright comment in a header file with a highly generic error like:

#include errors detected. Please update your includePath. IntelliSense features for this translation unit (/path/to/main.cpp) will be provided by the Tag Parser.

When intellisense is in this bad state, the status bar icon still indicates "everything is fine", which seems strange.

@zry9056 sometimes it helps to open the problems pane with View: Focus Problems.

prideout avatar Apr 25 '19 15:04 prideout

@zry9056 I'm closing this but feel free to reopen if you are still having problems.

mikeblome avatar May 02 '19 21:05 mikeblome