Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. `Project ERROR: Unknown module(s) in QT: gui` Even when QtGui not configured in
Forum Updated to NodeBB v4.3 + New Features

`Project ERROR: Unknown module(s) in QT: gui` Even when QtGui not configured in

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 2.4k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    patrickkidd
    wrote on 5 Oct 2022, 22:59 last edited by patrickkidd 10 May 2022, 23:01
    #1

    It looks like QT += gui is added implicitly in qmake projects. At least in 5.15.2. This throws the error: Project ERROR: Unknown module(s) in QT: gui. Adding QT -= gui fixes the problem. But my .pro files are auto-generated (by sip) so I can't add a line to the end of them. So how is it possible to prevent Qt from implicitly adding gui to QT when QtGui is not configured to build?

    configure line:

    ./configure -opensource -confirm-license -release -nomake examples -nomake tests -prefix $HOME/qt -no-feature-concurrent -no-feature-dbus -no-feature-network -no-feature-sql -no-feature-testlib -no-feature-xml -no-gif -no-libjpeg -no-mtdev -no-sql-db2 -no-sql-ibase -no-sql-mysql -no-xcb -qt-freetype -no-fontconfig -no-harfbuzz -no-xcb-xlib -no-cups -no-iconv -no-icu -no-eglfs -no-gui -no-widgets -no-feature-gui -skip qtgui -skip qtactiveqt -skip qtcanvas3d -skip qtgamepad -skip qtremoteobjects -skip qtscript -skip qtspeech -skip qtvirtualkeyboard -skip qtwayland -skip qtwebview -skip qtnetwork

    notice: -no-gui -no-widgets -no-feature-gui -skip qtgui

    Example qmake file that breaks:

    TEMPLATE = app
    SOURCES = main.cpp
    

    And file that works:

    TEMPLATE = app
    SOURCES = main.cpp
    QT -= gui
    

    At the end of the day, all I'm trying to do is build a qt make and lib that has qtcore and nothing else. For backward compatibility I just need to use a library that uses qbytearray and no other classes. If there is a cleaner way to configure qt that would be great. But the configure line above is the best I can come up with.

    https://alaskafamilysystems.com/

    J 1 Reply Last reply 6 Oct 2022, 01:29
    0
    • P patrickkidd
      5 Oct 2022, 22:59

      It looks like QT += gui is added implicitly in qmake projects. At least in 5.15.2. This throws the error: Project ERROR: Unknown module(s) in QT: gui. Adding QT -= gui fixes the problem. But my .pro files are auto-generated (by sip) so I can't add a line to the end of them. So how is it possible to prevent Qt from implicitly adding gui to QT when QtGui is not configured to build?

      configure line:

      ./configure -opensource -confirm-license -release -nomake examples -nomake tests -prefix $HOME/qt -no-feature-concurrent -no-feature-dbus -no-feature-network -no-feature-sql -no-feature-testlib -no-feature-xml -no-gif -no-libjpeg -no-mtdev -no-sql-db2 -no-sql-ibase -no-sql-mysql -no-xcb -qt-freetype -no-fontconfig -no-harfbuzz -no-xcb-xlib -no-cups -no-iconv -no-icu -no-eglfs -no-gui -no-widgets -no-feature-gui -skip qtgui -skip qtactiveqt -skip qtcanvas3d -skip qtgamepad -skip qtremoteobjects -skip qtscript -skip qtspeech -skip qtvirtualkeyboard -skip qtwayland -skip qtwebview -skip qtnetwork

      notice: -no-gui -no-widgets -no-feature-gui -skip qtgui

      Example qmake file that breaks:

      TEMPLATE = app
      SOURCES = main.cpp
      

      And file that works:

      TEMPLATE = app
      SOURCES = main.cpp
      QT -= gui
      

      At the end of the day, all I'm trying to do is build a qt make and lib that has qtcore and nothing else. For backward compatibility I just need to use a library that uses qbytearray and no other classes. If there is a cleaner way to configure qt that would be great. But the configure line above is the best I can come up with.

      J Offline
      J Offline
      JKSH
      Moderators
      wrote on 6 Oct 2022, 01:29 last edited by
      #2

      @patrickkidd said in `Project ERROR: Unknown module(s) in QT: gui` Even when QtGui not configured in:

      It looks like QT += gui is added implicitly in qmake projects.

      Yes, this is specified in the documentation: https://doc.qt.io/qt-6/qmake-variable-reference.html#qt

      But my .pro files are auto-generated (by sip) so I can't add a line to the end of them.
      So how is it possible to prevent Qt from implicitly adding gui to QT when QtGui is not configured to build?

      You have 2 options:

      • Don't skip the Qt GUI module, OR
      • Modify the qmake source code before building, to stop it from adding gui by default (I don't know where this code is)

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kkoehne
        Moderators
        wrote on 6 Oct 2022, 06:34 last edited by
        #3

        @JKSH is right, this is documented behavior, so the generator should be ideally adapted.

        The code that adds core and gui by default to QT is in mkspecs/features/spec_pre.prf . You could modify this file directly (breaking behavior for all other qmake apps), set up your own profile / .prf file, or reset the content of QT on the command line:

        qmake -after QT=core
        

        Director R&D, The Qt Company

        1 Reply Last reply
        2

        1/3

        5 Oct 2022, 22:59

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved