clangd
clangd copied to clipboard
The function is defined in the .c file. Using vscode-clangd to go to the definition does not take effect.
Please describe the problem. For hints on what information is helpful, see: https://clangd.llvm.org/troubleshooting.html
Installing clangd in Theia and VSCode is the same problem
If you can, provide a minimal chunk of code that shows the problem (either inline, or attach it if larger).
Logs
Please attach the clangd stderr log if you can. (Usually available from the editor)
If possible, run with --log=verbose - note that the logs will include the contents of open files!
If this is a crash, try to put llvm-symbolizer on your PATH per the troubleshooting instructions.
System information
Output of clangd --version: 16.0.0
Editor/LSP plugin: vscode-clangd 0.1.24
Operating system: Windows 10
Please take another look at the bug report template, and actually provide the requested information, instead of just copying the questions. In particular:
If you can, provide a minimal chunk of code that shows the problem (either inline, or attach it if larger).
and
Please attach the clangd stderr log if you can. (Usually available from the editor)
New header file testh.h
Contents of the file:
void swap(int a, int b);
New source file testc.c Contents of the file: ` #include "testh.h"
Void swap (int a, int b) { Int temp = a A = b B = temp } `
In the testh.h file, use the right mouse button to find the swap function definition, what appears is the list of function references, is the function normal?
Your project doesn't have a compile_commands.json file.
Please have a look at https://clangd.llvm.org/installation#project-setup.
Note that finding a definition in a different translation unit requires background indexing to work, so compile_flags.txt is not sufficient, compile_commands.json needs to be used.
Your project doesn't have a
compile_commands.jsonfile.Please have a look at https://clangd.llvm.org/installation#project-setup.
Note that finding a definition in a different translation unit requires background indexing to work, so
compile_flags.txtis not sufficient,compile_commands.jsonneeds to be used.
I was also troubled by this problem untill I saw your answer. Thank you for your this ! It is easy for newbies like us to be blocked by some small problems