I'm using VS Code with the clangd plugin and it can't find <stdio.h>
. Clangd is able to parse all of the source files in my project without any problem. But certain header files are not found by clangd, and for other header files, clangd finds the wrong ones. My compiler is arm-none-eabi-gcc so I expect clangd to parse the .h files from that development package. How do I get clangd to search through the arm-none-eabi-gcc headers and not my system headers?
Asked
Active
Viewed 150 times
1

Ryan Jensen
- 207
- 1
- 9
1 Answers
1
The answer is in the clangd documentation.
On Linux, use this command to find where you compiler lives:
which arm-none-eabi-gcc
On my machine, this particular compiler happens to be here /home/ryan/devpkg/arm-none-eabi/bin/arm-none-eabi-gcc
To fix clangd, you need to pass it an argument when you run the clangd
command:
clangd --query-driver=/path/to/mygcc
But replace /path/to/mygcc
with the path to your compiler.
In VS Code, this is done by adding an argument to clangd's settings:
File -> Preferences -> Settings -> Workspace (or User if you always use this compiler) -> Extensions -> clangd -> Arguments -> Add Item
Now when your cursor hovers over stdio.h
, it displays the correct path:

Ryan Jensen
- 207
- 1
- 9