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. Qmake include order
Forum Updated to NodeBB v4.3 + New Features

Qmake include order

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 450 Views
  • 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.
  • D Offline
    D Offline
    Dan Bumbarger
    wrote on last edited by
    #1

    On windows, I install many libraries with vcpkg. One of the libraries I use installs some Qt components into it's include folder. (including many things in QtCore and QtWidgets). The vcpkg installation is using Qt5, whereas most of my development is in Qt6. If I include another library installed through vcpkg (in my case zeromq, but it doesn't matter) the order of the includes causes QMake to use files from the wrong Qt installation (In my case Qt5 instead of Qt6.2.1). This breaks many things with changes between 5 and 6, including QJsonobject, and Qmetaproperty, etc.. Below is an excerpt from a makefile.debug showing what I mean.

    INCPATH       = -I..\CompileTest -I. -IC:\src\vcpkg\installed\x64-windows\include -IC:\Qt\6.2.1\msvc2019_64\include -IC:\Qt\6.2.1\msvc2019_64\include\QtCore -Idebug -IC:\Qt\6.2.1\msvc2019_64\mkspecs\win32-msvc 
    

    The vcpkg include comes from adding the following line to my .pro file:

    INCLUDEPATH += C:/src/vcpkg/installed/x64-windows/include
    

    Because the vcpkg include folder (which includes a QtCore folder) appears before the correct QtCore folders for Qt6, I get problems. If I edit the file so that the normal Qt install includes show up first everything is fine. Is there an easy way to force QMake to include it's own directories first? Doesn't seem to matter in what order I put things in the .pro file. This feels like a bug, or at least not desirable behavior? I'd like for a lot of people to be able to easily compile what I am working on, so manually editing the makefiles seems like a clumsy solution.

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Dan-Bumbarger said in Qmake include order:

      This feels like a bug, or at least not desirable behavior?

      Since you must not mix Qt5 and Qt6 I don't see a problem here.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      0
      • D Offline
        D Offline
        Dan Bumbarger
        wrote on last edited by
        #3

        I guess the problem is that rather than putting the Qt6 include locations first (specified by Qt Creator), it puts the Qt5 ones first (specified by a separate include folder of vcpkg that also has QtCore(qt5) as well as the library I actually want to include (zeromq). This is causing Qmake to find the Qt5 files first on things that are not included in the .pro file. By that I mean things like QtGui and Qt Widgets end up coming from Qt6, and other things inluded by QtWidgets end up coming from the Qt5 (obviously not desired). This is fixed if I manually change the order of INCPATH in the makefile.debug. If QMake instead put it's own includes first, or at least in the order they appear in the .pro file, then there would not be a problem. Does this make sense? As it is now, it appears that QMake put's things like the include directory for QtCore (-IC:\Qt\6.2.1\msvc2019_64\include\QtCore in my case) at the END of the includes, even if I explicitly include it at the beginning of my .pro file.

        1 Reply Last reply
        0

        • Login

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