reddit / emacs

lsp-mode and AVR development?

BaldSuperHare · 2022-06-14 20:17
How do I configure lsp-mode to actually find the AVR headers? As an example I'm getting errors (file not found) for avr/io.h and other AVR specific headers. EDIT: I use clangd.
TunaCowboy · 2022-06-15 01:19
I'm going to assume you're using `clangd`. The proper way is to generate a `compile_commands.json`: https://clang.llvm.org/docs/JSONCompilationDatabase.html You can also just throw this in a file, `.clangd`, at your project's root: CompileFlags: Add: - "-I/usr/include/<nested_include>" - "-I/home/you/code/c/projects/<project>/include"
BaldSuperHare · 2022-06-15 06:44
Thanks, you assumed correctly, sorry for not including this info.
seregaxvm · 2022-06-15 10:45
There's a number of projects to autogenerate `compile_commands.json`. For make based projects I use [bear](https://github.com/rizsotto/Bear).