[英]How to add PoDoFo external library to my C++ project in Qt Creator?
I am using Qt Creator, Qt6, C++ for my program.我正在为我的程序使用 Qt Creator、Qt6、C++。
I would like to use the PoDoFo library but I have no knowledge of how to add the library/headers so that I can use it in my project and build it.我想使用 PoDoFo 库,但我不知道如何添加库/标头,以便我可以在我的项目中使用它并构建它。
I have downloaded the PoDoFo code, just can't find any guidance/tutorials on how to add PoDoFo specifically in Qt Creator.我已经下载了 PoDoFo 代码,只是找不到关于如何在 Qt Creator 中专门添加 PoDoFo 的任何指导/教程。
Edit: I tried "Add Library" to my project and used external library option.编辑:我尝试“添加库”到我的项目并使用外部库选项。 Once I finish, I try to compile my code and I get an error "podofo-0.9.7\\COPYING.LIB:-1: error: LNK1107: invalid or corrupt file: cannot read at 0x62DC"完成后,我尝试编译我的代码,但出现错误“podofo-0.9.7\\COPYING.LIB:-1:错误:LNK1107:无效或损坏的文件:无法在 0x62DC 读取”
I can include the podofo.h file but that will also throw this error:"podofo-0.9.7\\src\\podofo\\base\\PdfCompilerCompat.h:44: error: C1083: Cannot open include file: 'podofo_config.h': No such file or directory"我可以包含 podofo.h 文件,但这也会引发此错误:"podofo-0.9.7\\src\\podofo\\base\\PdfCompilerCompat.h:44: error: C1083: Cannot open include file: 'podofo_config.h':无此文件或目录”
.pro file: 。轮廓:
QT += core gui sql printsupport
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++17
# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
#QMAKE_CXXFLAGS += -std=c++17
SOURCES += \
addbookdialog.cpp \
addbooksdialog.cpp \
bookdetailswindow.cpp \
bulkdetailsdialog.cpp \
cleanebooksdialog.cpp \
insertlinkdialog.cpp \
inserttabledialog.cpp \
linkcollectiondialog.cpp \
linkmanagerwindow.cpp \
main.cpp \
mainwindow.cpp \
searchnamedialog.cpp \
summarywindow.cpp
HEADERS += \
addbookdialog.h \
addbooksdialog.h \
bookdetailswindow.h \
bulkdetailsdialog.h \
cleanebooksdialog.h \
common.h \
insertlinkdialog.h \
inserttabledialog.h \
linkcollectiondialog.h \
linkmanagerwindow.h \
mainwindow.h \
queries.h \
searchnamedialog.h \
summarywindow.h
FORMS += \
addbookdialog.ui \
addbooksdialog.ui \
bookdetailswindow.ui \
bulkdetailsdialog.ui \
cleanebooksdialog.ui \
insertlinkdialog.ui \
inserttabledialog.ui \
linkcollectiondialog.ui \
linkmanagerwindow.ui \
mainwindow.ui \
searchnamedialog.ui \
summarywindow.ui
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
DISTFILES += \
style.qss
RESOURCES += \
images.qrc \
style.qrc
unix|win32: LIBS += -L$$PWD/3rdparty/podofo-0.9.7/ -lCOPYING
INCLUDEPATH += $$PWD/3rdparty/podofo-0.9.7/src/podofo
DEPENDPATH += $$PWD/3rdparty/podofo-0.9.7/src/podofo
Did you take a look on this link: https://doc.qt.io/qt-5/third-party-libraries.html ?您是否查看过此链接: https : //doc.qt.io/qt-5/third-party-libraries.html ?
I just followed it and my 3rdParty library ( https://github.com/cutelyst/simple-mail ) was linked and accessible from my application C++.我只是跟着它,我的 3rdParty 库( https://github.com/cutelyst/simple-mail )已链接并可从我的应用程序 C++ 访问。 Basically, your .pro file will look like this after setting everything properly:基本上,正确设置所有内容后,您的 .pro 文件将如下所示:
TARGET = MyQtApp
TEMPLATE = app
INCLUDEPATH += 3rdparty/CatWhisperer/include
SOURCES += src/main.cpp
LIBS += -L"3rdparty/CatWhisperer/lib" -lCatWhisperer
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.