im new to system programming, idk if thats the issuse. but according gcc, it can not find dbus/dbus-arch-deps.h and thats all i know. any idea about this issue?
program
[I] tomri@artix ~ [1]> cat main.c
#include <dbus-1.0/dbus/dbus.h>
int main(void) { return 0; }
# error
[I] tomri@artix ~> gcc main.c
In file included from main.c:1:
/usr/include/dbus-1.0/dbus/dbus.h:29:10: fatal error: dbus/dbus-arch-deps.h: No such file or directory
29 | #include <dbus/dbus-arch-deps.h>
| ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
[I] tomri@artix ~> ls -la /usr/include/dbus-1.0/dbus/
total 216
drwxr-xr-x 2 root root 4096 Jul 2 20:26 ./
drwxr-xr-x 3 root root 4096 Jun 15 21:36 ../
-rw-r--r-- 1 root root 2809 Jan 14 06:17 dbus-address.h
-rw-r--r-- 1 root root 3470 Jan 14 06:17 dbus-bus.h
-rw-r--r-- 1 root root 27018 Jan 14 06:17 dbus-connection.h
-rw-r--r-- 1 root root 2909 Jan 14 06:17 dbus-errors.h
-rw-r--r-- 1 root root 22076 Jun 8 2023 dbus-glib-bindings.h
-rw-r--r-- 1 root root 2575 Jun 8 2023 dbus-glib-lowlevel.h
-rw-r--r-- 1 root root 14766 Jun 8 2023 dbus-glib.h
-rw-r--r-- 1 root root 8969 Jun 8 2023 dbus-gtype-specialized.h
-rw-r--r-- 1 root root 1464 Jun 8 2023 dbus-gvalue-parse-variant.h
-rw-r--r-- 1 root root 7246 Jan 14 06:17 dbus-macros.h
-rw-r--r-- 1 root root 1961 Jan 14 06:17 dbus-memory.h
-rw-r--r-- 1 root root 15259 Jan 14 06:17 dbus-message.h
-rw-r--r-- 1 root root 1810 Jan 14 06:17 dbus-misc.h
-rw-r--r-- 1 root root 3809 Jan 14 06:17 dbus-pending-call.h
-rw-r--r-- 1 root root 23956 Jan 14 06:17 dbus-protocol.h
-rw-r--r-- 1 root root 5412 Jan 14 06:17 dbus-server.h
-rw-r--r-- 1 root root 5392 Jan 14 06:17 dbus-shared.h
-rw-r--r-- 1 root root 3047 Jan 14 06:17 dbus-signature.h
-rw-r--r-- 1 root root 2359 Jan 14 06:17 dbus-syntax.h
-rw-r--r-- 1 root root 8505 Jan 14 06:17 dbus-threads.h
-rw-r--r-- 1 root root 4143 Jan 14 06:17 dbus-types.h
-rw-r--r-- 1 root root 3961 Jan 14 06:17 dbus.h
[I] tomri@artix ~>
# my system
[I] tomri@artix ~> uname --all
Linux artix 6.9.7-artix1-1 #1 SMP PREEMPT_DYNAMIC Fri, 28 Jun 2024 18:11:28 +0000 x86_64 GNU/Linux
thanks! this allows me compile my program with no error. why gcc couldnt do this automatically? i mean its supposed to do this right? and another important issue that clang ls (language server) showed the same error? i thought fixing this would fix that too, but that isnt the case here. without clang ls running i wont get any auto completions. thanks again
why gcc couldnt do this automatically? i mean its supposed to do this right?
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.
and another important issue that clang ls (language server) showed the same error? i thought fixing this would fix that too, but that isnt 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 called compile_commands.json.
In your trivial case, running this should be enough: