Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

webenginewidgets on .pro of library produce error



  • I have created a project using QWebEngine and would want to convert it as a library (Shared Library) so that it can be integrate to any project. To test it, I created a subdir project first, then a library which will use qwebengine and a console project that will manage the library to run.

    On .pro of the library and console project, I assume it is needed to include QT += core gui webenginewidgets, but I keep getting errors about qwebenginewidgets. I need qwebenginewidgets to be able to use qwebengine classes like QWebEngineView. How am I going to fix this?


  • Qt Champions 2019

    @LovelyGrace said in webenginewidgets on .pro of library produce error:

    but I keep getting errors about qwebenginewidgets

    when compiling your lib or the project using your lib?
    And what errors are those?



  • I am getting :-1: error: [sub-WebLogin-qmake_all] Error 3 or unknown: webenginewidgets, something like that.

    I wonder if it's because of the kit? does webenginewidgets only works at qt 5.9+ version?



  • And is it because of the msvc version?


  • Lifetime Qt Champion

    Hi,

    What version of Qt are you using ?
    What compiler are you using ?

    Yes, QtWebEngine has more drastic restrictions with regards to compilers because of Chromium that it uses internally. So depending on the Qt version you are currently using, you would need to have either MSVC2015 (pre-Qt 5.12) or MSVC2017 (starting with Qt5.12).



  • I am using msvc 2015 and 2017 Qt 5.9.6 and it works as console project. Why isn't it working as library?

    How about mingw?


  • Lifetime Qt Champion

    It shouldn't make any difference.

    Can you show both the console and library .pro files ?



  • now i'm getting error from the subdir project C1083: Cannot open include file: 'QWebEngineView': No such file or directory when I tried to include QWebengine classes

    This is the library.pro
    QT += webenginewidgets
    QT += webchannel websockets network
    QT += core gui

    CONFIG += c++11 console
    CONFIG -= app_bundle

    TARGET = WebLogin
    TEMPLATE = lib

    DEFINES += WEBLOGIN_LIBRARY
    DEFINES += QT_DEPRECATED_WARNINGS

    SOURCES +=
    weblogin.cpp
    Encryption/qblowfish.cpp
    WebSocket/websocketclientwrapper.cpp
    WebSocket/websockettransport.cpp

    HEADERS +=
    weblogin.h
    weblogin_global.h \
    Encryption/qblowfish.h
    Encryption/qblowfish_p.h
    WebSocket/websocketclientwrapper.h
    WebSocket/websockettransport.h

    unix {
    target.path = /usr/lib
    INSTALLS += target
    }

    and the console.pro
    QT -= gui

    CONFIG += c++11 console
    CONFIG -= app_bundle

    DEFINES += QT_DEPRECATED_WARNINGS

    SOURCES +=
    main.cpp

    win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../WebLogin/release/ -lWebLogin
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../WebLogin/debug/ -lWebLogin
    else:unix: LIBS += -L$$OUT_PWD/../WebLogin/ -lWebLogin

    INCLUDEPATH += $$PWD/../WebLogin
    DEPENDPATH += $$PWD/../WebLogin

    and the sub dir.pro
    QT += webenginewidgets
    QT += webchannel websockets network
    QT += core gui

    TEMPLATE = subdirs

    SUBDIRS +=
    WebLogin
    ManageLogin

    When I tried to build the library only, it doesn;t produce the error, but when I am trying to build the whole project from sub dir project including the library and the console, it produce the error

    I am only using kit msvc 2015 and 2017 Qt 5.9.6


  • Qt Champions 2019

    This post is deleted!

  • Qt Champions 2019

    @LovelyGrace said in webenginewidgets on .pro of library produce error:

    but when I am trying to build the whole project from sub dir project including the library and the console, it produce the error

    You need to add Qt += webenginewidgets to your console project as well.


Log in to reply