-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#include errors detected. Please update your includepath. #4718
Comments
Can you enable logging of the language server and share the logs? |
Loginitialized 1 "/dev/null"1 ""#define STDC 1 1 "/dev/null"1 ""#define STDC 1 I'm sorry that the logs are in german. Is it possible to change the language? |
@mxsrv The C/C++ extension follows the display language used on VS Code. You can change the display language of VS Code by following instructions at https://code.visualstudio.com/docs/getstarted/locales. |
Hello, i have the same problems with user-defined libs in the respective includePath of projects. I'm using VSC in conjunction with Platformio and the bug only occurs since C/C++ version 0.26.2. After testing some things, I downgraded to 0.26.1 and after a restart, the error didn't occur. A new update to 0.26.2 caused the error again. I put a .h file under /include in the project and it makes no difference if I include the file with #include "fram.h" or with #include <fram.h>. These 2 errors always appear when starting VSC if /src/main.cpp was open during the last session:
The error messages were translated by a translator from German into English and may not contain the correct wording. Here are the original messages:
If the file was not open and is opened afterwards, the error does not occur. As mentioned before, it does not happen with version 0.26.1. If you need more information, please let us know. Many greetings |
@wapjoe Can you run |
@michelleangela Log diagnosis with error (file opened): |
@michelleangela Further note: |
Your As for the Can you also provide English logs from the language server? To change the display language of VS Code, follow instructions at https://code.visualstudio.com/docs/getstarted/locales. |
@michelleangela thx for your help Here the logfile, I hope it was right, seems to be very long: Log
|
Your log file doesn't show any missing include error message. Can you provide a log file that repros the bug? Do you see a includePath missing in the logging that corresponds to the missing include error? |
What have I done wrong? After the instructions I set the logging level to debug, in the output panel I set C/C++. In the output appears "Update IntelliSense time (sec): 1.156". When I set the Log Filter to one of the projects (C/C**: ....) with the Include error and open the main.cpp, it appears:
However, the error does not occur during subsequent opening. When restarting VSC, with the opened file, the output panel first starts with the filter "tasks", when I switch back to "C/C**: ..." this log appears and the include error is still displayed in the program: Log
|
The logs show there are no error squiggles and yet squiggles are displayed for #include. Are you using multiroot, that is more than one project in a VS Code workspace? If so, the logging that displayed/selected with currently opened file could be for a different project, and to better isolate the issue, only open one project to ensure the correct log is displayed/selected. |
Ah, you mean just one project per workspace? I will test tomorrow (European Time) and give feedback. |
Yes, one project per workspace. There are currently some IntelliSense issues when trying to work with multiple projects in one workspace. This could be a new issue. |
Okay, I'll try it tomorrow and report on it. :-) |
Hi @wapjoe . In the log output, it mentions: "Error squiggle count: 0". For the scenario in which you are seeing the error squiggle, you should see a squiggle count > 0. The "update your includepath" error comes from the IntelliSense process. The output from |
Hi @Colengms |
Hello @michelleangela When starting with main.cpp still open, no error is displayed anymore, so I don't think the debug output is needed and probably didn't output anything else than before? Too many projects have accumulated in my old workspace over the years, so I wanted to clean it up anyway. ;-) So I will add more projects to the workspace and test the behavior. If there are already problems with a few projects, I will temporarily change to version 0.26.1, but I'm happy to be available for further tests. The result, from how many projects it comes to the error, I write later still. Thanks for your support so far! Update! If I create a new workspace and integrate my projects in small steps (5 each) (add folders to workspace, not as new projects) and restart VSC, there is no error with all 22 projects. However, if I remove all the folders and insert the 22 project folders at once, the include error will occur the next time VSC restarts. 2nd update... The solution only works if the project with the include error is inserted first. For example, if 1 or more project(s) are added without the error and the problematic project is added to Wordplace after that, the include error will reappear when restarting with main.cpp open. Very strange and I can't explain it... |
I'm seeing the same
|
@jxramos It could be that the language server is unable to query the compiler for the system include paths. Can you provide the following additional info to help us further investigate:
|
@michelleangela how can I test whether or not I have multiple projects in a workspace? Is that to say I open VSCode on some folder I'm not sure how to engage the log from running first bullet point item. The second item I'm assuming you're referring to enabling the logging for the language server bit from the documentation? |
@jxramos In your case, it sounds like you're only opening one folder. The command For the second logging (that logs info about what's happening with the language server) follow "enable the logging for the language server" https://code.visualstudio.com/docs/cpp/enable-logging-cpp#_enable-logging-for-the-language-server. |
Here's the logs as rendered... C/C++: Log diagnostics
And here's the Language Server LogsSome of the bits of possible interest...
|
@michelleangela, just as a good tip for git hub issue readability it may be better to post the language server log as a file attachment. Mine was incredibly long. Should be a good recommendation for the vscode staff to request comments with that information be uploaded as such. That is until github implements some scrollable code block that enters scrollmode after some 200 lines or whatever the threshold is. |
There are some linux specific variants for sure resolvable on my imports folders, maybe I have the order mixed up?Just double checked includePath does have my systemIncludePath as the first element. As further background I basically tarred up The immediate children to my And cross referencing to a gnu c library mirror on GitHub it appears to be this version of the file: I'm assuming clang uses the Could it be that the language server needs to properly evaluate all header possibilities? So maybe even though the one in my systemIncludePath is legit presumably another in the |
Hi @jxramos . Right after "sending compilation args for" in the language server logs, it lists the includes and defines we passed to the IntelliSense process. Since there are a bunch of compiler-specific defines there, it looks like the compiler is being interrogated successfully. However, the only headers listed are:
I had assumed based on the Could you try running clang with the following argments?
That's the command we're sending to clang to detect system includes and defines. Look for the list of system includes. If there are some there and we're not picking them up, could you copy the output to a file and post it here? |
Beautiful stuff, if that's the case it does indeed appear the compiler isn't looking in the expected system include path according to my VSCode settings. It's looking at these paths instead...
full console output at clang_check.txt If I probe my MacOS System Includes I get the following hits (system_include_hits.txt) from running this script below. echo =================================================== > system_include_hits.txt
echo find /usr/local/include >> system_include_hits.txt
find /usr/local/include >> system_include_hits.txt
echo =================================================== >> system_include_hits.txt
echo find /Library/Developer/CommandLineTools/usr/include/c++/v1 >> system_include_hits.txt
find /Library/Developer/CommandLineTools/usr/include/c++/v1 >> system_include_hits.txt
echo =================================================== >> system_include_hits.txt
echo find /Library/Developer/CommandLineTools/usr/lib/clang/10.0.1/include >> system_include_hits.txt
find /Library/Developer/CommandLineTools/usr/lib/clang/10.0.1/include >> system_include_hits.txt
echo =================================================== >> system_include_hits.txt
echo find /Library/Developer/CommandLineTools/usr/include >> system_include_hits.txt
find /Library/Developer/CommandLineTools/usr/include >> system_include_hits.txt
echo =================================================== >> system_include_hits.txt
echo find /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include >> system_include_hits.txt
find /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include >> system_include_hits.txt
echo =================================================== >> system_include_hits.txt
echo "find /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks (framework directory)" >> system_include_hits.txt
find "/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks" >> system_include_hits.txt Tracing the memory example there is one path it should resolve at...
All it does is import string... /*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)memory.h 8.1 (Berkeley) 6/2/93
*/
#include <string.h> String itself appears safe too, there's a few hits actually.
Pretty mysterious. Either way just wondering if the correct behavior would be to pass on the value of This is all very interesting, there's like overlapping tools coordinated together to give us the VSCode C++ experience. Some subset of those tools are happy with the information I provide, but the language server tool is not happy somehow. Am I reading things right? |
@jxramos , The C/C++ Extension (this repo) doesn't actually build or compile. We only invoke the compiler for the purpose of querying it for system includes and defines, which we pass along to a separate process which parses (first-pass compiles) the code to generate IntelliSense information. All of the paths you see after "#include <...> search starts here:" should be passed along to the IntelliSense process. However, I don't see these being passed to it:
We do confirm that paths exist before using them. Are these paths present on your system? |
They're certainly present, the |
I wonder if the process is being blocked by some security permissions or something of the like preventing it from observing the protected folders given to it. |
This is how you collapse long text in GitHub
|
Yeah, seems like we could use more logging between when it queries the compiler and when something goes wrong to cause the compiler's includePaths to not be used. |
I am also getting this issue on Ubuntu. Intellisense/code formatting doesn't find any files in |
@RogerLevy What is your compilerPath and includePath? When you do C/C++: Log Diagnostics are the includePaths correct? |
This is the same issue i have in #4444 EDIT: Examples using absolute paths.With recursive only
Without recursive (working kinda)
Here it shows that it does not seem to respect the "**" in the configurations file. Can't find file, even though file is in include path #include "Helpers/CBEAccountEvent.h" <-- Error (Path: tests/include/Helpers/)
We are 3 people who work with the same project with the exact same configuration They do not get this error. H:\LIBXAPI\LOCAL_SYNC_LIB\TESTS\CBE\TESTOPERATIONQUEUE.CPP Tag parsing encountered a error, but it may not matter. Let us know if symbols in the file can't be found: H:\LIBXAPI\LOCAL_SYNC_LIB\LIB\INCLUDE\WDEX4\BOOST\INCLUDE\BOOST\THREAD\PTHREAD\CONDITION_VARIABLE_FWD.HPP
|
If anyone has trouble getting c/c++ to run in vscode do watch this video. It has step by step guide on setting up c/c++ on vscode for windows and also some possible error fixes !! |
Hi everyone 🤘
Can u help me guys @michelleangela, @sean-mcmanus , @Colengc C++ language server logsIntelliSense Engine = Default.The extension will use the Tag Parser for IntelliSense when #includes don't resolve.
C++ Diagnostics
|
@GrayHub-737 Change your C_Cpp.intelliSenseEngineFallback setting to "Disabled". Also, remove the system include paths from includePath. You may also want to remove compilerArgs if that is causing problems. |
Thanks for your feedback @sean-mcmanus The compilerArgs always remove themselves automatically on "c/c++ edit Configurations (UI)". And I have set C_Cpp.intelliSenseEngineFallback setting to "Enable", also the include paths are removed. But nothing hopeful has happened |
Hi @sean-mcmanus ,I no longer have problems with my include paths right now. I learned something from However every time I try to compile and run the file I receive no output from the integrated terminal. But whenever I debug the file its outputs are easily shown on the external console... What have I done wrong? |
I don't think integrated terminal support for the debugger has been implemented. I think there's another issue tracking that. @WardenGnaw might know more. |
Integrated terminal is supported for all platforms if you just want to see output. There is no psuedo-tty for macOS so far, so input is broken. @GrayHub-737 Which OS are you using? Can you share your |
@WardenGnaw unfortunately I'm no longer faced with that problem anymore right after I restarted my windows machine. But just to give you an idea of what was happening. Whenever I compile then run my cpp executable file, it'll skip the output part then show me my workspace directory. As if I just directly pressed enter. |
I was also encountering the issue with the "#include errors detected" in (almost) any header file I opened. There was a single header file (which should not have been included in any other header file), that could not find one of its headers, causing the error message on any header file. In my case, my project roughly looks like this:
My internal_dependency.hpp includes some config.h, that is auto-generated (using CMake). I added "build/" to my include option and the error was gone. My mylib.code-workspace:
|
I ran into this today on my MacBook (macOS Catalina 10.15.5). What solved it for me was:
And somewhere in this process, the problem was fixed for me. |
It works! Thanks |
Hey @sean-mcmanus, this issue might need further attention. @mxsrv, you can help us out by closing this issue if the problem no longer exists, or adding more information. |
This issue has been closed automatically because it needs more information and has not had recent activity. |
Yes, I know that I'm not the first user with this problem. But I tried all the different ways explained in other issues to fix the problem and can't get to a solution.
It says: "configure your Intelli-Sense-Settings to search missing headers"
"#include errors detected. please update your includepath"
My c_cpp_properties.json:
`{
}`
The text was updated successfully, but these errors were encountered: