Unsolved './ui_mywidget.h' file not found
-
I justed create a project by default with qt 6.4.2 and qt creator 9.0.1
here's my steps:
new project-> Application(qt)--> Qt Widgets Application-->
F:\qt\myWidget\mywidget.cpp:2: error: './ui_mywidget.h' file not found
-
@chunxu
ui_mywidget.h
is a file generated by runninguic
on a.ui
(Desisgner) file. It won't be created until the first time you run a Build. It will be placed not where your source files are but rather in the build output directory. I am not sure whether there is any significance to the error message have./
in the reported./ui_mywidget.h'
file not found. -
@JonB thank you, I knew it's generated by uic & after the first build after searched from google.
What confused me is that after i built the proejct, and the window showed OK, the error still there.
-
@chunxu
Did you start by verifying that it is indeed generated and placed into the build output directory? Either- It's not there; or
- That directory is (somehow) not being used to include
./ui_mywidget.h
.
-
@JonB The header file is placed in folder below by the QT creator.
F:\qt\build-myWidget-Desktop_Qt_6_4_2_MinGW_64_bit-Debug\myWidget_autogen\include
-
@chunxu
That is not a directory I am familiar with, it would not have gone there with Qt5, I don't know if that has changed and you are maybe using Qt6. Make sure that directory is on the list of directories search for include files in your project when the compile command is executed. -
This post is deleted! -
@JonB
Anyway, thanks for your help!
Seems the product was not well tested.
It works OK when I chose qmake as the build tool. -
@chunxu
Yes, cmake (default at Qt6) is quite different from qmake (default at Qt5), your project would need to be reconfigured if changing between the two.