sazr
sazr

Reputation: 25928

What is the gdbus library name? Technique to find it?

What library do I need to include to use Bluez gdbus.h functions? I am getting alot of undefined reference errors for gdbus.h functions so I obviously I am missing a library.

*Is there a way (in terminal or otherwise) I can find out what library a header file uses? For example; I can find where a header file resides using locate gdbus.h. Is there a way I can find out what library gdbus.h requires?

My current pkg-config is:

pkg-config --cflags gio-2.0 dbus-glib-1 dbus-1 glib-2.0 gthread-2.0
pkg-config --libs gio-2.0 dbus-glib-1 dbus-1 glib-2.0 gthread-2.0

With this I get many undefined references such as:

agent.c:100: undefined reference to 'g_dbus_send_reply'
agent.c:104: undefined reference to 'g_dbus_send_reply'
agent.c:107: undefined reference to 'g_dbus_send_error'

What library am I missing?

Upvotes: 2

Views: 4193

Answers (2)

Zimano
Zimano

Reputation: 2299

gbdus.h is located in the BlueZ user space source code, which in order to use, should be downloaded and maybe compiled.

http://git.kernel.org/cgit/bluetooth/bluez.git/tree/gdbus

The link above points to the folder that you're looking for in the source of this user space package. The header file is in there too. The file structure corresponds to the structure of the user space source code you should have downloaded. From there you can include the files you were missing.

Upvotes: 2

nemequ
nemequ

Reputation: 17492

The gdbus functions are part of the gio library, so the gio-2.0 package is what you want.

The reason gdbus/gdbus.h isn't found is that it doesn't exist. I don't even have a package which provides a gdbus.h, much less gdbus/gdbus.h. The right file to include is gio/gio.h, which will include all the necessary headers for the entire gio library, including the 22 for gdbus.

Get rid of dbus-glib-1; it's deprecated (in favor of gdbus). If your code uses gdbus it's very unlikely it also requires dbus-glib.

Upvotes: 9

Related Questions