c++ PackageKit newb链接问题
C++ PackageKit newb linking issue
我正试图将PackageKit导入到我正在使用的c++项目中(作为一个来自Java背景的c++新手)。我的目标是用我在系统上安装的包做一些事情。
我已经安装了libpackagekit-glib2-16
, libpackagekit-glib2-dev
, libpackagekit-qt2-6
, libpackagekit-qt2-dev
和packagekit
(我知道我不需要所有这些,但我现在只是覆盖我的基础)。我可以看到它们已经安装在这里:/usr/include/PackageKit
,它有packagekit-glib2
, packagekit-qt2
, plugin
子文件夹。
为了帮助我,我正在使用qt 5.2.1作为我的Makefiles拐杖,而我还在学习,但我现在并没有实际使用任何qt资源。我已经能够通过-lapt-lib
和-ldpkg
在qt的LIBS+=
下导入apt和dpkg的库,但我不知道如何导入packagekit的库(我尝试过多种变体,但我不知道如何正确导入此库)。
:
#define I_KNOW_THE_PACKAGEKIT_GLIB2_API_IS_SUBJECT_TO_CHANGE
#include <PackageKit/packagekit-glib2/packagekit.h>
int main(int argc, char *argv[])
{
return 0;
}
结果如下:
g++ -c -std=c++11 -g -Wall -W -D_REENTRANT -fPIE -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_CORE_LIB -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -I../console-example -I/usr/include/qt5 -I/usr/include/qt5/QtCore -I. -I. -o main.o ../console-example/main.cpp
In file included from ../console-example/main.cpp:3:0:
/usr/include/PackageKit/packagekit-glib2/packagekit.h:31:41: fatal error: packagekit-glib2/pk-catalog.h: No such file or directory
#include <packagekit-glib2/pk-catalog.h>
如果这是必要的,我的系统是Ubuntu 14.04 64bit
,正如我提到的,我使用qt 5.2.1
来帮助制作文件。提前感谢大家!
这似乎是一个编译问题。编译器找不到packagekit的头文件。我想在g++行中你需要添加-I/usr/include/PackageKit
或类似的东西。
从我的qt项目的.pro文件中,我不得不做以下补充,以获得它的编译和链接。
CONFIG += link_pkgconfig # This enables the next line
PKGCONFIG = gtk+-2.0 # This will link against gtk+-2.0
INCLUDEPATH += /usr/include/PackageKit/ # This is the include for packagekit
+= /usr/lib/glib-2.0/include/ # This will include glib, which packagekit is dependent on
相关文章:
- 静态数据成员的问题-修复链接错误会导致编译器错误
- 基于boost的程序的静态链接——zlib问题
- 使用jsoncpp库时出现链接问题
- Cmake 链接问题:未定义对 Button::mousePressEvent(QGraphicsSceneMouseE
- sqlite3 和生成文件中的链接出现问题
- 如何将GTest与CMake一起使用?遵循谷歌指南时的链接问题
- 未解决的外部链接问题
- 使用转换器提升 Python 问题 - 静态链接
- 'make check' GLIBC 运行时的链接问题
- 在树莓派上用libtorch构建程序时的链接问题
- QtCreator with C 库中的链接器问题
- 野牛弹性链接问题
- 与 AWS 开发工具包的链接问题
- 使用 NVIDIA GPU 在 Cygwin 中链接 OpenCL 库时遇到问题
- 为什么当我从语句检查中删除"+ mod"时,以下程序给出错误的答案。问题链接:https://www.codechef.com/problems/FFC219B
- PCL 和 CMake 的问题:链接时未定义统计异常值删除
- VC++使用gumbo查询时出现问题(链接错误)
- 使用CMake问题链接Boost(Ubuntu 14.04)
- MySQL连接器问题-链接等等
- MinGW 与 MSVC 的 dll 库问题链接(未定义的引用)