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 -> CONFIG variable -> thread
Forum Updated to NodeBB v4.3 + New Features

Qmake -> CONFIG variable -> thread

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 5.3k Views 1 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.
  • napajejenunedk0N Offline
    napajejenunedk0N Offline
    napajejenunedk0
    wrote on last edited by
    #1

    Guys, is it necessary to include the following qmake statement:
    @
    CONFIG += thread
    @

    or

    @
    CONFIG *= thread
    @

    ... when creating other threads?

    The "thread":http://qt-project.org/doc/qt-4.8/qmake-variable-reference.html#config CONFIG variable's member does the following as stated by the qmake variable reference:

    bq. The target is a multi-threaded application or library. The proper defines and compiler flags will automatically be added to the project.

    As far as I can see by:
    @
    message($$CONFIG)
    @

    ... on Windows, the printed output contains:
    @
    thread_off
    @

    When I add:
    @
    CONFIG += thread
    @

    ... the CONFIG variable contains both "thread_off" and "thread".

    Is it necessary to add this statement and if so, is the "thread_off" CONFIG member a standard one that, for instance, explicitly removes the helper utilities added by "thread"?

    Is the following code correct:
    @
    CONFIG -= thread_off
    CONFIG *= thread
    @

    1 Reply Last reply
    0
    • napajejenunedk0N Offline
      napajejenunedk0N Offline
      napajejenunedk0
      wrote on last edited by
      #2

      The "qmake's exists() conditional function":http://qt-project.org/doc/qt-4.8/qmake-function-reference.html#exists-filename gives an example that contains the qmake's code:
      @
      CONFIG += thread
      @

      ... and it seems that this library is added only on Linux, since the filename starts with "lib" and is followed by lowercase "qt". The same library is not included for Mac OS and all "$(QTDIR)/lib/lib*" files are named "libQt*" - uppercase "Q".

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

        Interesting discovery. I have to admit I've never used the "thread" config variable and my threaded applications have always worked. Altough I'm only using them on linux. Maybe Microsoft® Windows® is different there.

        1 Reply Last reply
        0
        • napajejenunedk0N Offline
          napajejenunedk0N Offline
          napajejenunedk0
          wrote on last edited by
          #4

          My multi-threaded ones work as well, but since I have spotted this CONFIG variable's parameter decided that it does something extra.

          1 Reply Last reply
          0
          • JKSHJ Offline
            JKSHJ Offline
            JKSH
            Moderators
            wrote on last edited by
            #5

            http://community.kde.org/Qt5/Documentation/RenewalProjectOverview#The_Fix_List

            Search for the string "CONFIG += qt thread"; that config variable is outdated, and will be removed from Qt 5's documentation.

            Multi-threading was enabled by default in Qt 4.0, so that variable is no longer needed.

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

            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