【问题标题】:Qt5 migration: Cannot open include file: 'qtconcurrentexception.h': No such file or directoryQt5 迁移:无法打开包含文件:'qtconcurrentexception.h':没有这样的文件或目录
【发布时间】:2014-04-09 01:43:43
【问题描述】:

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

fatal error C1083: Cannot open include file: 'qtconcurrentexception.h': No such file or directory

对于这一行:

#include <qtconcurrentexception.h>

我包含这个文件是为了使用QtConcurrent::ExceptionQtConcurrent::Exception 的头文件有变化吗?

【问题讨论】:

    标签: c++ qt qt5


    【解决方案1】:

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

    如果您需要&lt;QtModule/QHeader&gt; 形式的包含,这意味着您没有将相关的Qt 模块添加到您的项目文件中。稍后您将收到链接错误,即使这种被黑的包含似乎在编译期间起作用。

    QtConcurrent::Exception 已弃用,只是从核心模块转发到QException。所以:

    #include <QException>
    

    如果您希望在 Qt 5 中将并发模块用于其他用途,您应该#include &lt;QtConcurrent&gt;。您还应该将Qt += concurrent 添加到您的项目文件中,然后重新运行 qmake。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-07-04
      • 2013-11-05
      • 2014-05-07
      • 2017-02-22
      • 2013-11-01
      • 2017-03-31
      • 2015-11-11
      相关资源
      最近更新 更多