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 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
    • Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 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 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.

        jsulmJ 1 Reply Last reply
        0
        • D Dvassily

          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.

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on 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 last edited by
            #5

            I already tried the complete rebuild : nothing changed.

            By the way, i don't use qmake.

            jsulmJ 1 Reply Last reply
            0
            • D Dvassily

              I already tried the complete rebuild : nothing changed.

              By the way, i don't use qmake.

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on 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 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
                • Christian EhrlicherC Online
                  Christian EhrlicherC Online
                  Christian Ehrlicher
                  Lifetime Qt Champion
                  wrote on 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 last edited by
                    #9

                    It solved the problem. Thank you !

                    Christian EhrlicherC 1 Reply Last reply
                    0
                    • D Dvassily

                      It solved the problem. Thank you !

                      Christian EhrlicherC Online
                      Christian EhrlicherC Online
                      Christian Ehrlicher
                      Lifetime Qt Champion
                      wrote on 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 last edited by
                        #11
                        This post is deleted!
                        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