Qt 6.11 is out! See what's new in the release
blog
Creator / cmake: Header file of promoted widgets not found
-
I am creating a cmake project in QtCreator 20.0.0 and while I usually work with MSVC, I am now trying to compile the project using another kit. However, doing so triggers an error where the header files of my promoted widgets cannot be found, like this one:
In file included from C:\Users\...\source\repos\wasmwidgets\mainwindow.cpp:2: C:/Users/.../source/repos/wasmwidgets/build/Desktop_Qt_6_11_1_MinGW_64_bit_Debug/wasmwidgets_autogen/include/ui_mainwindow.h:18:10: fatal error: label.h: No such file or directory 18 | #include <label.h> | ^~~~~~~~~To make sure I was not messing up something, I started with a fresh Widgets project:
- Create a new Qt Widgets project, with CMake.
- Open the automatically-created
MainWindow.uiand add a QLabel in it. - Compile the project and run.
This should be successful with all kits. - Create a subclass of QLabel(Let's call it Label); it does not need to override any method from QLabel.
Promote the label created in step2.to that new class. It seems not to matter whether or not you tick "Global Include". - Recompile the project.
It now is successful only with MSVC, but it fails with e.g. MinGW and Emscripten.
I do not see a meaningful difference between e.g. the below 2 configurations.


Would you know what is wrong here?
-
You forgot to add the directory where label.h is in to your include directories for your compiler.
-
F FX David has marked this topic as solved