Cannot find libs for QPrinter and unicodeUTF8

  • I am building C++ software from source on Fedora20. I have the following libraries:

    @ qt5-qtbase-devel qt5-qtdeclarative-devel qt5-qtscript-devel
    qt5-qtwebkit-devel qt5-qtsvg-devel qt5-qttools-devel

    qmake appears to run ok:

    @[root@localhost subsurface]# qmake-qt5 --version
    QMake version 3.0
    Using Qt version 5.4.0 in /usr/lib64

    I use qmake like this:

    No errors displayed, I assume headers generated are ok.

    Upon make, the following Qt-related errors:

    @[root@localhost subsurface]# make


    @compiling main.cpp
    In file included from /usr/include/QtGui/QTextEdit:1:0,
    from .uic/ui_mainwindow.h:26,
    from qt-ui/mainwindow.h:14,
    from main.cpp:11:
    /usr/include/QtGui/qtextedit.h:235:16: error: ‘QPrinter’ has not been declared
    void print(QPrinter *printer) const;


    @In file included from qt-ui/tableview.h:10:0,
    from .uic/ui_diveplanner.h:26,
    from qt-ui/diveplanner.h:140,
    from .uic/ui_mainwindow.h:30,
    from qt-ui/mainwindow.h:14,
    from main.cpp:11:
    .uic/ui_tableview.h: In member function ‘void Ui_TableView::retranslateUi(QGroupBox*)’:
    .uic/ui_tableview.h:49:87: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
    TableView->setWindowTitle(QApplication::translate("TableView", "GroupBox", 0, QApplication::UnicodeUTF8));

    I suspect I am missing one or two more Qt libraries.
    Any advice, please?
    Kind regards,

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Did you add

    @QT += printsupport@

    to your pro file ?

    On a side note, it's a very bad idea to develop as root, you can destroy your system any time without even noticing it.

  • Thanks very much for your response. The profile has:

    @QT_CONFIG -= no-pkg-config
    QT = core gui network svg
    lessThan(QT_MAJOR_VERSION, 5) {
    QT += webkit
    } else {
    QT += printsupport concurrent
    !android: QT += webkitwidgets webkit
    android: QT += androidextras

    For Fedora, which libraries contain QPrinter and unicodeUTF8 ??

  • Lifetime Qt Champion

    Wait, are you porting a Qt 4 application to Qt 5 ?

  • No, the code has already been ported, but I get a link error upon building the code. As you can see from the snippet, the initialisation is different for Qt5 as compared to older versions of Qt.

    In which Fedora Qt library file(s) does one find QPrinter and unicodeUFT8 ??

  • Lifetime Qt Champion

    UnicodeUTF8 has been obsoleted in Qt 5

    QPrinter should be in gui for Qt 4 and printsupport for Qt 5

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.