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. Compilation errors with Qt6 and QtConcurrent::run
Forum Updated to NodeBB v4.3 + New Features

Compilation errors with Qt6 and QtConcurrent::run

Scheduled Pinned Locked Moved Solved General and Desktop
11 Posts 4 Posters 861 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
    Dvassily
    wrote on 25 Mar 2021, 15:21 last edited by
    #1

    Hello !

    In my project, i try to execute a member function asynchronously with the help of QtConcurrent::run :

    	ulong histogramId = histogramWidget->allocate();
    	QFuture<void> future = QtConcurrent::run(&HistogramWidget::computeHistogram, histogramWidget, std::cref(image), histogramId);
    	QFutureWatcher<void>* watcher = new QFutureWatcher<void>();
    	
    	 connect(watcher, &QFutureWatcher<Histogram>::finished, this, [this, histogramId]() {
    		histogramWidget->drawHistogram(histogramId);
    	 });
    
    	 watcher->setFuture(future);
    

    Therefore, i included the following header in my source file :

    #include <QtConcurrentRun>
    

    Which generates the following errors at compilation time :qfuture_impl_errors.png

    I compile with MSVC 2019 64 bits, and i included the core and concurrent modules.

    Could you help me?

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 25 Mar 2021, 15:29 last edited by
      #2

      I would start with a clean simple main.cpp and include the header to see if it compiles.

      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
      1
      • D Offline
        D Offline
        Dvassily
        wrote on 25 Mar 2021, 15:37 last edited by
        #3

        I just tried this and yes, it does compile.

        One more detail : the project compiled fine some hours ago, and the changes i made since don't concern the class containing the QtConcurrent::run call.

        J 1 Reply Last reply 25 Mar 2021, 15:41
        0
        • D Dvassily
          25 Mar 2021, 15:37

          I just tried this and yes, it does compile.

          One more detail : the project compiled fine some hours ago, and the changes i made since don't concern the class containing the QtConcurrent::run call.

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 25 Mar 2021, 15:41 last edited by
          #4

          @Dvassily Try a complete rebuild: delete build folder, run qmake and build

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • D Offline
            D Offline
            Dvassily
            wrote on 25 Mar 2021, 15:50 last edited by
            #5

            I already tried the complete rebuild : nothing changed.

            By the way, i don't use qmake.

            J 1 Reply Last reply 25 Mar 2021, 15:51
            0
            • D Dvassily
              25 Mar 2021, 15:50

              I already tried the complete rebuild : nothing changed.

              By the way, i don't use qmake.

              J Offline
              J Offline
              jsulm
              Lifetime Qt Champion
              wrote on 25 Mar 2021, 15:51 last edited by
              #6

              @Dvassily What is the very first error message you get?

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • D Offline
                D Offline
                Dvassily
                wrote on 25 Mar 2021, 15:53 last edited by
                #7

                The first error message is "missing type spcifier - int assumed. Note: C++ does not support default-int" in qfuture_impl.h at line 175.

                1 Reply Last reply
                0
                • C Offline
                  C Offline
                  Christian Ehrlicher
                  Lifetime Qt Champion
                  wrote on 25 Mar 2021, 17:36 last edited by
                  #8

                  Move the header up until the error no longer occurs. Daily programming business...

                  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
                  2
                  • D Offline
                    D Offline
                    Dvassily
                    wrote on 26 Mar 2021, 09:33 last edited by
                    #9

                    It solved the problem. Thank you !

                    C 1 Reply Last reply 26 Mar 2021, 09:34
                    0
                    • D Dvassily
                      26 Mar 2021, 09:33

                      It solved the problem. Thank you !

                      C Offline
                      C Offline
                      Christian Ehrlicher
                      Lifetime Qt Champion
                      wrote on 26 Mar 2021, 09:34 last edited by
                      #10

                      @Dvassily I think it would be interesting for others what the problem was. And don't forget to mark the thread as solved then.

                      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
                      • S Offline
                        S Offline
                        sarthak031
                        wrote on 26 Mar 2021, 09:56 last edited by
                        #11
                        This post is deleted!
                        1 Reply Last reply
                        0

                        1/11

                        25 Mar 2021, 15:21

                        • Login

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