Qt World Summit: Register Today!

QWebKit Compile error concerning macros

  • I'm using Ubuntu 14.04 which doesn't support QWebEngine so I'm trying to port QWebEngine to QWebKit and I'm getting the following compiler error:

    In file included from /usr/include/qt5/QtNetwork/qsslcertificate.h:53:0,
                     from /usr/include/qt5/QtNetwork/qsslerror.h:47,
                     from /usr/include/qt5/QtNetwork/qsslsocket.h:50,
                     from /usr/include/qt5/QtNetwork/qsslconfiguration.h:61,
                     from /usr/include/qt5/QtNetwork/QSslConfiguration:1,
                     from /usr/include/qt5/QtNetwork/qnetworkaccessmanager.h:47,
                     from /usr/include/qt5/QtWebKitWidgets/qwebview.h:29,
                     from /usr/include/qt5/QtWebKitWidgets/QWebView:1,
                     from /home/user/MyHeader.h:8,
                     from /home/user/MySource.cpp:1:
    /usr/include/qt5/QtCore/qdatetime.h:122:77: error: macro "min" requires 2 arguments, but only 1 given
         static inline qint64 nullJd() { return std::numeric_limits<qint64>::min(); }
    /usr/include/qt5/QtCore/qdatetime.h: In static member function ‘static qint64 QDate::nullJd()’:
    /usr/include/qt5/QtCore/qdatetime.h:122:73: error: invalid conversion from ‘long long int (*)()noexcept (true)’ to ‘qint64 {aka long long int}’ [-fpermissive]
         static inline qint64 nullJd() { return std::numeric_limits<qint64>::min(); }

    I looked around a few forums and tried the suggestions but nothing worked. I added NOMINMAX to the QT DEFINES in the make file as well as added but nothing helped.

    My Qt code has been integrated with existing non-Qt code so if there is a macro conflict I never saw it with QWebEngineView.

  • Lifetime Qt Champion


    What version of Qt are you using ?

  • @SGaist It was the version offered in apt-get. It was qt5-default...not sure which version that installs.

  • Lifetime Qt Champion

    apt-cache policy qt5-default

  • @anshah said in QWebKit Compile error concerning macros:

    Ubuntu 14.04

    Ubuntu 14.04 ships with Qt 5.2 with QtWebKit from Qt 5.1. Both are horribly outdated, QtWebKit 5.1 is based on WebKit engine sources from 2012 so don't expect it to handle modern web content.

    However, I have no clue about this compilation error. At least it has nothing to do with QtWebkit, as QtCore/qdatetime.h doesn't compile.

  • @SGaist

    Installed: (none)
    Candidate: 5.2.1+dfsg-1ubuntu14.3
    Version table:
    5.2.1+dfsg-1ubuntu14.3 0
    500 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
    500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
    5.2.1+dfsg-1ubuntu14 0
    500 http://us.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages

  • @Konstantin-Tokarev

    Thank you guys I appreciate your responses.
    I have developed my application using QWebEngine from an installer which I downloaded from download.qt.io. Since Ubuntu 14.04 only supports up to Qt 5.8 that's the version I installed.

    The reason I wanted to try porting back to QtWebKit in the first place is because I wanted to install Qt using an install from "apt-get" instead of the installer provided by the Qt site. The problem is the QWebEngine is not available using "apt-get" unless I add the ethereum repository which came with it's own host of problems. QWebkit is available under the "apt-get" packages so I thought I could do the Qt install like this:

    sudo apt-get install qt-default
    sudo apt-get install libqt5webkit5-dev

    So I installed Qt with QWebKit and I got the compile issue above. However, if you are saying that it doesn't handle modern web content and is outdated then I'll just stick with QWebEngine and not mess around with QtWebKit.

    Since ethereum repository is unreliable the only reliable way I can get Qt with QWebEngine on Ubuntu 14.04 is by installing the Qt 5.8 installer. Now my application build has an RPM spec file with "Requires" and "BuildRequires" tags where packages are added for dependencies:


    BuildRequires: build-essential
    Requires: qt5-default 
    Requires: qt5webengine5-dev

    Since I'm installing Qt using an installer how do I indicate this in "BuildRequires" or "Requires" since there are no packages associated with this. The installer just places the needed include and libraries in /opt/Qt5.8.0 which I find and point to in my Makefile. Is there a way to indicate this in RPM? Maybe the library names?

  • In RPM you can only have things (files, packages, "provides") installed by RPM as dependencies of your package

Log in to reply