0

I am using Qt Creator, Qt6, C++ for my program.

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.

I have downloaded the PoDoFo code, just can't find any guidance/tutorials on how to add PoDoFo specifically in Qt Creator.

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"

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"

.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

qt creator add library dialog: enter image description here

Attitude12136
  • 47
  • 2
  • 9
  • did you build and install the library? – ΦXocę 웃 Пepeúpa ツ Jul 05 '21 at 18:39
  • @ΦXocę웃Пepeúpaツ no, that's the thing. I don't know what to do. I have never used an external C++ library in a project before. – Attitude12136 Jul 05 '21 at 19:06
  • @ΦXocę웃Пepeúpaツ Please, would really appreciate help. I don't want to compile and use binaries. I want to add the source code so that my app and the library compile together. – Attitude12136 Jul 06 '21 at 18:41
  • @mariofares You better share your .pro file and header and/or source files that are relevant. In that case, someone more likely can help, I think. – atakli Jul 14 '21 at 10:47

1 Answers1

1

Did you take a look on this link: 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++. Basically, your .pro file will look like this after setting everything properly:

TARGET = MyQtApp

TEMPLATE = app

INCLUDEPATH += 3rdparty/CatWhisperer/include

SOURCES += src/main.cpp

LIBS += -L"3rdparty/CatWhisperer/lib" -lCatWhisperer
  • I edited my question to include my pro file, still it doesn't work and I get errors. COPYING.LIB:-1: error: LNK1107: invalid or corrupt file: cannot read at 0x62DC – Attitude12136 Jul 28 '21 at 12:21