D-Bus连接问题

vku*_*vku 9 dbus pkg-config linker-errors

我一直在尝试编译一个程序dbus,正如我在代码中提到的那样,提到了类似的问题.我按照图示执行了它:

gcc `pkg-config --cflags dbus-glib-1` \
  `pkg-config --cflags dbus-1` \
  `pkg-config --cflags glib-2.0` \
   dbus-example.c \
  `pkg-config --libs dbus-glib-1` \
  `pkg-config --libs dbus-1` \
  `pkg-config --libs glib-2.0`
Run Code Online (Sandbox Code Playgroud)

我仍然收到以下错误:

Package dbus-glib-1 was not found in the pkg-config search path.
Perhaps you should add the directory containing `dbus-glib-1.pc'
to the PKG_CONFIG_PATH environment variable
No package 'dbus-glib-1' found
Package glib-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `glib-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'glib-2.0' found
Package dbus-glib-1 was not found in the pkg-config search path.
Perhaps you should add the directory containing `dbus-glib-1.pc'
to the PKG_CONFIG_PATH environment variable
No package 'dbus-glib-1' found
Package glib-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `glib-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'glib-2.0' found 
Run Code Online (Sandbox Code Playgroud)

我安装了上面提到的软件包,但仍然存在错误.

wjt*_*wjt 18

您是否为这些库安装了开发包,或者仅为库本身安装了开发包?在Debian/Ubuntu上,你想要libdbus-glib-1-dev和其他类似的-dev包; 在Fedora上,你想要dbus-glib-devel和类似的.