-
Notifications
You must be signed in to change notification settings - Fork 59
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
Eclipse indexer unable to find std or the first C++ include in files #1865
Comments
Note, the lack of diagnostics about subsequent includes is a symptom of the clang parser giving up after failing to resolve the first include; it doesn't even try resolving subsequent ones.
We'll need clangd logs to diagnose the issue. Maybe @ghentschke can advise how to get those for this editor. However, the most common solution for this type of issue is to specify |
As @HighCommander4 already mentioned is the problem that clangd cannot determine the path to standard library. I think there has been major improvements in cangd version >16 on determining the system includes. The cdt-lsp plugin already uses the You can enable the Language Server Logging in the Eclispe Preferences here: |
Thank you @ghentschke. I think this highlights the issue. The tools folder structure for the ESP32 ESP-IDF SDK I'm using is a bit peculiar. This is what I have configured for the Editor (LSP): Here is the context of the directory structure where the tools are. The |
@mbratch Please feel free to share language server logs taken as shown above. Those will indicate what path needs to be specified in the "Drivers" field. |
This CDT fix might be helpful, since it fixes a bug for cc.exe on Windows. |
Here is my language server log: |
This contains the LSP traffic, but not the language server's own logs. As discussed at https://clangd.llvm.org/troubleshooting#gathering-logs (emphasis mine):
@ghentschke is there a way to get at clangd's full stderr output with CDT-LSP? |
@HighCommander4 ok sorry for the error. The configuration instructions above indicated checking "log to console", so I naturally assumed I was to capture what was printed on the console. Seems a bit confusing. I'll get the correct log and attach when I get a chance. |
@HighCommander4 I think this is what you looking for: I[08:33:54.418] clangd version 16.0.2 (https://github.com/llvm/llvm-project 18ddebe1a1a9bde349441631365f0472e9693520)
I[08:33:54.419] Features: windows+grpc
I[08:33:54.419] PID: 9648
I[08:33:54.419] Working directory: C:\Users\ghent\cdt-main\eclipse
I[08:33:54.419] argv[0]: C:\temp\clangd-windows-16.0.2\clangd_16.0.2\bin\clangd.exe
I[08:33:54.419] argv[1]: --clang-tidy
I[08:33:54.419] argv[2]: --background-index
I[08:33:54.419] argv[3]: --completion-style=detailed
I[08:33:54.419] argv[4]: --pretty
I[08:33:54.419] argv[5]: --query-driver=C:/Daten/msys64/mingw64/bin/*
I[08:33:54.425] Starting LSP over stdin/stdout
I[08:33:54.475] <-- initialize("1")
I[08:33:54.483] --> reply:initialize("1") 8 ms
I[08:33:54.498] <-- initialized
I[08:33:54.508] <-- textDocument/didOpen
I[08:33:54.622] System includes extractor: successfully executed C:\Daten\msys64\mingw64\bin\clang.exe
got includes: "C:/Daten/msys64/mingw64/include/c++/11.2.0, C:/Daten/msys64/mingw64/include/c++/11.2.0/x86_64-w64-mingw32, C:/Daten/msys64/mingw64/include/c++/11.2.0/backward, C:/Daten/msys64/mingw64/lib/clang/13.0.0/include, C:/Daten/msys64/mingw64/x86_64-w64-mingw32/include, C:/Daten/msys64/mingw64/include"
got target: "x86_64-w64-windows-gnu" I've to check how to print this to the Eclipse log. |
Yep, exactly! This contains information printed by clangd (such as the "System includes extractor" line) which is very useful for diagnosing issues of this sort. Note that there is also more verbose logging (lines starting with |
@mbratch Please run your Eclipse.exe or IDE executable from a command window with the Eclipse.exe -consolelog This will open a console window with the logging of the Java process. You should see the clangd log entries as shown in my post above. |
Hello @ghentschke. Thank you for your continued help. I ran the console log as you suggested, attached here. |
Based on the log, the issue seems to be the mismatch between the I think the difference in slashes is fine, since the actual path gets normalized and on Windows the normalized path should have backslashes, and so it's only the So, I would expect changing the contents of that "Drivers" field to be |
Thank you @HighCommander4, I changed the Drivers field to indicate g++ as you noted, but I am still getting the same problem. Is there anything I need to do after changing the Drivers setting to "re-evaluate"? |
I think a restart of Eclipse should do it. If that still doesn't help, could you re-take the logs with |
I just realized something: the clangd patch to normalize the driver path has not appeared in a release yet; it will appear in clangd 18. So, with clangd 17 and earlier, the direction of the slashes is important, and so in your case you'd need to set the "Drivers" field to |
Thanks @HighCommander4 that all seems to have cleared up the problem! |
I am running Eclipse version 2023-09 (4.29.0) and have the Espressif ESP-IDF plugin version 2.11.1.202310270725 installed.
I installed the clangd indexer and disabled the default indexer per the instructions at this link. The installation of the clangd indexer went smoothly, but to get it to take effect, I had to delete my project and re-import it.
My first problem with the indexer is that it seems to have trouble finding standard C++ headers. It says "Use of undeclared identifier 'std'" when I reference an
std
library method.It also claims it can't find the string header file as indicated below. I noticed that this happens with the first #include in the file. So if I first #include then #include it will indicate memory cannot be found but it finds string. Weird.
FInally, I also don't see any context menu commands for "Open declaration". The other indexer supported it. Is that feature unavailable with the clangd indexer?
I've attached the Eclipse log.
eclipse.log
The text was updated successfully, but these errors were encountered: