Qt5迁移:无法打开包含文件:'qtconcurrentexception.h':没有这样的文件或目录

sas*_*alm 3 c++ qt qt5

我正在将一个项目迁移到Qt5,我收到了这个错误(它为Qt4编译得很好):

fatal error C1083: Cannot open include file: 'qtconcurrentexception.h': No such file or directory
Run Code Online (Sandbox Code Playgroud)

对于这一行:

#include <qtconcurrentexception.h>
Run Code Online (Sandbox Code Playgroud)

我包含此文件以便使用QtConcurrent::Exception.头文件是否已QtConcurrent::Exception更改?

Rei*_*ica 6

以下所有内容仅适用于Qt 5.

如果您需要包含表单<QtModule/QHeader>,则表示您没有将相关的Qt模块添加到项目文件中.稍后您将获得链接错误,即使这样的黑客包含似乎在编译期间有效.

QtConcurrent::Exception不推荐使用,只是QException从核心模块转发到.所以:

#include <QException>
Run Code Online (Sandbox Code Playgroud)

如果你想在Qt 5中使用并发模块做其他事情,你应该这样做#include <QtConcurrent>.您还应该添加Qt += concurrent到项目文件中,然后重新运行qmake.