Solution:
- Make all command substition in a make done through the assignment operator e.g.
cflags != pkg-config --cflags gtk4
libs != pkg-config --libs gtk4
all:
gcc $(cflags) -o watch main.c $(libs)
not
all:
gcc $$(pkg-config --cflags gtk4) -o watch main.c $$(pkg-config --libs gtk4)
- add this to your .vimrc:
let g:ale_c_parse_makefile = 1
ALE gives me a warning when I use gtk
This is probably happening because ALE isn’t using my compiler flags gcc $( pkg-config --cflags gtk4 ) -o program main.c $( pkg-config --libs gtk4 )
that I stole from the gtk documentation. These compiler flags allow gcc to find gtk/gtk.h
even though it is in gtk-4.0/gtk/gtk.h
How do I make ALE aware of my compiler flags?
The following section of ALE’s wiki page might be helpful:
https://github.com/dense-analysis/ale#faq-c-configuration
I saw that but where do I put
compile_commands.json
? It isn’t workingmy compile_commands.json for reference:
[ { "directory": "/home/user/watch", "command": "/usr/bin/gcc $( pkg-config --cflags gtk4 ) -o program main.c $( pkg-config --libs gtk4 )", "file": "main.c" } ]
Seems like you solved it with the Makefile option but it is odd that
compile_commands.json
is not parsed (I can confirm this on my machine). Anyway thanks for providing a solution :)