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. error: QThread no member named create
QtWS25 Last Chance

error: QThread no member named create

Scheduled Pinned Locked Moved Unsolved General and Desktop
qthreadthreadingmulti-thread
9 Posts 4 Posters 1.6k 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.
  • R Offline
    R Offline
    rtvideo
    wrote on 18 Sept 2020, 13:25 last edited by
    #1

    Hello, I am trying to make a new thread using QThread by doing:

    QThread*  t1 = QThread::create(<function>)
    

    It tells me that there is no member named create in the QThread class, can anyone tell me why this would not be working?

    J 1 Reply Last reply 18 Sept 2020, 13:31
    0
    • R rtvideo
      18 Sept 2020, 13:25

      Hello, I am trying to make a new thread using QThread by doing:

      QThread*  t1 = QThread::create(<function>)
      

      It tells me that there is no member named create in the QThread class, can anyone tell me why this would not be working?

      J Offline
      J Offline
      JonB
      wrote on 18 Sept 2020, 13:31 last edited by JonB
      #2

      @rtvideo
      Have you included #include <QThread>? Is the actual message stating no member create at all, or no matching overload to your call? Which is why I always paste error messages :)

      1 Reply Last reply
      0
      • R Offline
        R Offline
        rtvideo
        wrote on 18 Sept 2020, 13:35 last edited by
        #3

        @JonB Yes I have included #include <QThread>

        full error message: error: no member named 'create' in 'QThread'

        J 1 Reply Last reply 18 Sept 2020, 13:41
        0
        • R rtvideo
          18 Sept 2020, 13:35

          @JonB Yes I have included #include <QThread>

          full error message: error: no member named 'create' in 'QThread'

          J Offline
          J Offline
          JonB
          wrote on 18 Sept 2020, 13:41 last edited by JonB
          #4

          @rtvideo
          I take it your are trying to call this overload: https://doc.qt.io/qt-5/qthread.html#create-1
          I agree it looks an odd message to me, I don't know whether compiler can throw that up if your <function> argument is not good.
          Does some other QThread method throw up same error, or is it because of create() only?
          Personally, I would empty out the debug/release directory of all files and recompile from scratch, just in case....
          Otherwise, probably state your Qt version, platform etc. for others to look at?
          Did you compile Qt yourself? I know there are some options to reduce what gets compiled, I don't know if there is some "no thread support" option.

          1 Reply Last reply
          1
          • R Offline
            R Offline
            rtvideo
            wrote on 18 Sept 2020, 13:49 last edited by
            #5

            @JonB Yes that is the one, it is strange because create() seems to be the only member in QThread that does not allow me to use it. Any other functions will work fine in the class. I am Using Qt Creator 4.13.1, Based on Qt 5.15.1 on Linux Ubuntu, I am using qmake to compile.

            J 1 Reply Last reply 18 Sept 2020, 14:08
            0
            • R rtvideo
              18 Sept 2020, 13:49

              @JonB Yes that is the one, it is strange because create() seems to be the only member in QThread that does not allow me to use it. Any other functions will work fine in the class. I am Using Qt Creator 4.13.1, Based on Qt 5.15.1 on Linux Ubuntu, I am using qmake to compile.

              J Offline
              J Offline
              JKSH
              Moderators
              wrote on 18 Sept 2020, 14:08 last edited by
              #6

              @rtvideo said in error: QThread no member named create:

              I am Using Qt Creator 4.13.1, Based on Qt 5.15.1 on Linux Ubuntu

              That tells us your version of Qt Creator, and the version of Qt that was used to build Qt Creator.

              What is the version of Qt that you're using to build your app?

              QThread::create() was introduced in Qt 5.10. It's not available if you're using Qt 5.9 or earlier.

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

              1 Reply Last reply
              2
              • R Offline
                R Offline
                rtvideo
                wrote on 18 Sept 2020, 14:19 last edited by
                #7

                @JKSH I see, I am using Qt version 5.9.5

                1 Reply Last reply
                0
                • R Offline
                  R Offline
                  rtvideo
                  wrote on 18 Sept 2020, 14:58 last edited by
                  #8

                  @JKSH Is there an easy way to upgrade my version through command line on Ubuntu?

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 18 Sept 2020, 18:22 last edited by
                    #9

                    That question is being answered on this thread.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    2

                    4/9

                    18 Sept 2020, 13:41

                    • Login

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