Difference between revisions of "D-Bus Linux"

From Teknologisk videncenter
Jump to: navigation, search
m (dbus programming)
m (dbus programming)
 
(One intermediate revision by the same user not shown)
Line 11: Line 11:
 
;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.
Find  
+
Find the necessary '''gcc''' options with '''pkg-config'''
 
<source lang=bash>
 
<source lang=bash>
 
heth@emb3:~$ pkg-config --libs --cflags dbus-1
 
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
 
-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
 
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>
 
</source>
 
[[Category:Linux]][[Category:C]]
 
[[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)