D-Bus gotchya

I happened to need to compile some D-Bus code and ran into a compile error:

dbus-example.c:8:23: error: dbus/dbus.h: No such file or directory

I checked to make the D-Bus development headers were installed and they were. A little Googling shows that others commonly run into this as well - the problem is that the D-Bus headers aren't included in the default compiler include path. You you need to explicitly specify them with:

gcc -I /usr/include/dbus-1.0 -I /usr/lib/dbus-1.0/include -ldbus-1 -o dbus-example dbus-example.c

Comments

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <br> <p> <i> <b> <center> <blockquote> <h3>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
Are you human?
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.