Compilation errors with Qt6 and QtConcurrent::run
-
wrote on 25 Mar 2021, 15:21 last edited by
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 :
I compile with MSVC 2019 64 bits, and i included the core and concurrent modules.
Could you help me?
-
I would start with a clean simple main.cpp and include the header to see if it compiles.
-
wrote on 25 Mar 2021, 15:37 last edited by
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.
-
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.
@Dvassily Try a complete rebuild: delete build folder, run qmake and build
-
wrote on 25 Mar 2021, 15:50 last edited by
I already tried the complete rebuild : nothing changed.
By the way, i don't use qmake.
-
@Dvassily What is the very first error message you get?
-
wrote on 25 Mar 2021, 15:53 last edited by
The first error message is "missing type spcifier - int assumed. Note: C++ does not support default-int" in qfuture_impl.h at line 175.
-
Move the header up until the error no longer occurs. Daily programming business...
-
wrote on 26 Mar 2021, 09:33 last edited by
It solved the problem. Thank you !
-
@Dvassily I think it would be interesting for others what the problem was. And don't forget to mark the thread as solved then.
-
wrote on 26 Mar 2021, 09:56 last edited byThis post is deleted!
1/11