linker-errors - D-Bus 链接问题

标签 linker-errors dbus pkg-config

我一直在尝试为 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`

我仍然收到以下错误:
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 

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

最佳答案

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

关于linker-errors - D-Bus 链接问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15239560/

相关文章:

elasticsearch - Docker centos7 systemctl deos无法正常工作:无法连接D-bus

dbus - Gnome 3 : Call sushi, 通过 DBus 的 Nautilus 快速文件预览器

linux - 什么是 dbus 守护进程以及为什么 vlc 需要它

iOS 项目在 Apple Mach-O 链接器错误中给出错误 "-bundle_loader can only be used with -bundle"

ios - 体系结构 armv7(FMDB) 的重复符号

c++ - 为什么此代码链接到 Intel Compiler 2015 而不是 Intel Compiler 2018?

embedded-linux - 在 pkg-config 搜索路径中找不到软件包 xkbcommon。构建 Yocto 图像时

c++ - Cygwin pkg-config/protobuf 文件路径问题

autotools - PKG_CHECK_MODULES 被认为是有害的?

c++ - CUDA C++ 链接错误 undefined reference threadIdx.x