Qt 5迁移-无法打开包含文件:'ui_mainwindow.h' [英] Qt 5 migration - Cannot open include file: 'ui_mainwindow.h'

查看:260
本文介绍了Qt 5迁移-无法打开包含文件:'ui_mainwindow.h'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将一个简单的项目迁移到Qt5.该项目最初是为Qt 4编写的,在这里可以很好地编译.

I'm trying to migrate a simple project to Qt 5. The project was originally written for Qt 4, and it compiles fine there.

但是,在使用Qt 5进行编译时,出现此错误:

When compiling with Qt 5, however, I'm getting this error:

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

现在我知道ui_mainwindow.h在编译时应该自动生成,并且我已经检查过了,并且在使用Qt 5编译时不会生成它.

Now I know that ui_mainwindow.h should be auto-generated when compiling, and I've checked and it is not being generated when compiling with Qt 5.

注意

这也发生在新创建的项目上.

This happens on a newly created project as well.

复制步骤:

  1. 在Qt Creator + Qt 4下创建新项目.
  2. 将项目复制到已安装Qt Creator + Qt 5的另一台计算机上.
  3. 打开项目,修复一些初始错误后,弹出该错误.

推荐答案

最后对我有用的是删除Debug和Release构建文件夹.奇怪的是,我最初没有复制它们,所以我不知道为什么它在首次创建后有助于删除它们.

What worked for me in the end was deleting both the Debug and Release build folders. What is strange is that I hadn't copied them initially, so I have no idea why it helped deleting them after they were first created.

但是,如果有人遇到此问题,请尝试删除Debug和Release文件夹以及.user文件.这将迫使Qt Creator重新配置您的项目.

But if anyone has this problem, try deleting the Debug and Release folders, as well as the .user file. This should force Qt Creator to reconfigure your project.

这篇关于Qt 5迁移-无法打开包含文件:'ui_mainwindow.h'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆