Home > Net >  'QtConcurrentRun': No such file or directory
'QtConcurrentRun': No such file or directory

Time:12-01

I am building a Qt project using Qt6.3.1. This project was originally written in earlier version of Qt (not quite sure about the specific version). Many Qt functions or modules need to be updated. It is noted QtConcurrentRun is noted supported by the recent Qt, since #include <QtConcurrentRun> gives the error: 'QtConcurrentRun': No such file or directory.

I was wondering what module in Qt 6 is equivalent to QtConcurrentRun. Is that QtConcurrent?

CodePudding user response:

Include QtConcurrent into the header file:

#include <QtConcurrent>

Add this line to your .pro file:

QT  = concurrent

Then you may call the run function:

QtConcurrent::run(QThreadPool::globalInstance(), function, ...);

If it doesn't work for you take a look at the QThread class.

More info here: QtConcurrent (Qt 6)

  •  Tags:  
  • qt
  • Related