QtWebEngine: No such file or directory



  • Neither the forum search nor Google turned up anything on this.

    I'm trying to use QtWebEngine in a QML program, all the latest versions, Windows 7, MSVC-2017 compiler. I checked the WebEngine item when I installed Qt Creator. Here's what I've done in my code:

    • Added webengine to the QT variable in the project file.
    • Added import QtWebEngine 1.7 to the QML file.
    • Added #include <QtWebEngine> to the main.cpp file.
    • Added QtWebEngine::initialize(); to the main function, after creating the app.

    I get C1083: Cannot open include file: 'QtWebEngine': No such file or directory.

    All of the above was per the instructions in the current QtWebEngine documentation. Then I tried the example WebEngine Quick Nano Browser, and it works fine.

    So what's the difference? It uses an earlier version of QtWebEngine, but I'm not getting far enough for that to matter. I found that its main.cpp says #include <QtWebEngine/qtwebengineglobal.h>. So I changed my application to include that. Now it compiles, but I get a link error on the QtWebEngine::initialize() function.

    But I still can't see any explanation why the quicknanobrowser project should find the initialize function but my project doesn't. Any ideas?


  • Qt Champions 2018

    @pderocco have you re-run qmake after your .pro file changes? In QtCreator Build > Run Qmake. Afterwards I'd do a full rebuild (Build > Rebuild all)



  • Yes, that seemed to work. The build system doesn't seem to be very good at knowing what depends on what.


  • Lifetime Qt Champion

    @pderocco
    Hi
    Its more about qmake having a cache to avoid re parsing whole of .pro file. It does detect changes (like adding a file ) but
    other changes requires a manual update.


Log in to reply
 

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