D-Bus Linux

From Teknologisk videncenter
Revision as of 10:43, 21 December 2022 by Heth (talk | contribs) (dbus programming)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


dbus programming

Install the dev files:

heth@emb3:~$ apt update
heth@emb3:~$ dpkg --search 'dbus/dbus.h'
libdbus-1-dev:amd64: /usr/include/dbus-1.0/dbus/dbus.h
heth@emb3:~$ sudo apt -y install libdbus-1-dev
Note
The dbus directory is under dbus-1.0 (Version 1.0) of dbus.

Find the necessary gcc options with pkg-config

heth@emb3:~$ pkg-config --libs --cflags dbus-1
-I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -ldbus-1
heth@emb3:~$ gcc dbus_ex.c -o dbus_ex -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -ldbus-1
 -OR-
heth@emb3:~$ gcc dbus_ex.c -o dbus_ex $(pkg-config --libs --cflags dbus-1)