Difference between revisions of "D-Bus Linux"

From Teknologisk videncenter
Jump to: navigation, search
(Created page with " =dbus programming= Install the dev files: <source lang=c> heth@emb3:~$ apt update heth@emb3:~$ dpkg --search 'dbus/dbus.h' libdbus-1-dev:amd64: /usr/include/dbus-1.0/dbus/db...")
 
m (dbus programming)
 
(2 intermediate revisions by the same user not shown)
Line 10: Line 10:
 
</source>
 
</source>
 
;Note:  
 
;Note:  
:The dbus directory is under dbus-1.0 (Version 1.0) of dbus.  
+
:The dbus directory is under dbus-1.0 (Version 1.0) of dbus.
:Use
+
Find the necessary '''gcc''' options with '''pkg-config'''
 +
<source lang=bash>
 +
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)
 +
</source>
 +
[[Category:Linux]][[Category:C]]

Latest revision as of 10:43, 21 December 2022


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)