Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt 5 migration - Cannot open include file: 'ui_mainwindow.h'

Tags:

c++

qt

qt5

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

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

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.


Note

This happens on a newly created project as well.

Steps to reproduce:

  1. Create new project under Qt Creator + Qt 4.
  2. Copy project to another machine where Qt Creator + Qt 5 has been installed.
  3. Open project, after fixing some initial errors this one pops up.
like image 446
sashoalm Avatar asked Oct 31 '13 16:10

sashoalm


1 Answers

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.

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.

like image 99
sashoalm Avatar answered Sep 17 '22 02:09

sashoalm