How to compile a basic D-Bus/glib example?

后端 未结 5 1998
攒了一身酷
攒了一身酷 2021-02-05 07:32

I\'m trying to learn how to use D-Bus with C bindings. I\'ve never used D-Bus before. I\'m following this tutorial, which I assume is the official one (Freedesktop.org). I\'ve r

5条回答
  •  情书的邮戳
    2021-02-05 08:01

    Based on the error returned by your gcc command. The gcc is able to see the file (otherwise it will display error message indicating that he is not able to see the header file) but is not able to see some variables that should be exist in this file (‘DBusGConnection’ and ‘GError’) . May be you are not using the adequate version of dbus

    and try to use make file instead of one command

    LDFLAGS+=-ldbus
    CFLAGS+=-I/usr/include/dbus-1.0/
    CFLAGS+=-I/usr/lib/i386-linux-gnu/dbus-1.0/include
    
    
    all: dbus-example.bin
    
    
    %.o: %.c
        $(CC) $(CFLAGS) -c -o $@ $^
    
    dbus-example.bin: my_dbus.o
        $(CC) $(LDFLAGS) -o $@ $^
    
    clean:
        rm -f *.o dbus-example.bin
    

提交回复
热议问题