0

我正在为我的程序使用 Qt Creator、Qt6、C++。

我想使用 PoDoFo 库,但我不知道如何添加库/标题,以便我可以在我的项目中使用它并构建它。

我已经下载了 PoDoFo 代码,只是找不到任何关于如何在 Qt Creator 中专门添加 PoDoFo 的指导/教程。

编辑:我尝试将“添加库”添加到我的项目并使用外部库选项。完成后,我尝试编译我的代码并收到错误“podofo-0.9.7\COPYING.LIB:-1: error: LNK1107: invalid or corrupt file: cannot read at 0x62DC”

我可以包含 podofo.h 文件,但这也会引发此错误:“podofo-0.9.7\src\podofo\base\PdfCompilerCompat.h:44: error: C1083: Cannot open include file: 'podofo_config.h':没有相应的文件和目录”

。轮廓:

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

qt 创建者添加库对话框: 在此处输入图像描述

4

1 回答 1

1

您是否查看过此链接:https ://doc.qt.io/qt-5/third-party-libraries.html ?

我只是跟着它,我的 3rdParty 库 ( https://github.com/cutelyst/simple-mail ) 已链接并可从我的应用程序 C++ 访问。基本上,正确设置所有内容后,您的 .pro 文件将如下所示:

TARGET = MyQtApp

TEMPLATE = app

INCLUDEPATH += 3rdparty/CatWhisperer/include

SOURCES += src/main.cpp

LIBS += -L"3rdparty/CatWhisperer/lib" -lCatWhisperer
于 2021-07-21T22:07:21.437 回答