% pkg-config --cflags dbus-1
-I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include
% pkg-config --libs dbus-1
-ldbus-1
gcc main.c `pkg-config --cflags --libs dbus-1`
You don't need to link against the library yet, but you will.
Linking might become a separate step when you have multiple files, not just main.
Because gcc is a compiler, not a build tool.
Maybe you come from a language where the two tasks are combined, but that's not the case here.
For the same reason stated above,
clangd
needs to know how you build your code. This is done via a JSON file calledcompile_commands.json
.In your trivial case, running this should be enough: