[Qt-interest] qmake does not support headers without a corresponding source file
Kustaa Nyholm
Kustaa.Nyholm at planmeca.com
Fri May 28 09:12:47 CEST 2010
> Do you have any cpp file in your project? Assuming on "I have added mywidgeth
> to myproject.pro and ran qmake"
>
Yes, lots of .cpp files in my project.
> If not then, you need to create one and include your header file. Even cpp
> file containing main function will work.
Yes, I understand that, but that is a workaround for what I perceive as
a problem qmake.
A cleaner workaround IMO is to have mywidget.cpp and just give up header
only classes.
No big deal, just one more file to create and one more line to add to .pro
file. But as Qt itself demonstrates with header only ui_ files it is a
legitimate and handy tool sometimes, only it seems it does not work in all
circumstances using qmake.
>
> Problem here is Compiler compiles source files and not .h files. In normal
> cases, .h files are compiled since they are included in at least one of the
> source files either directly or indirectly(through other header files). I
> don't t think there is any issue with qmake here.
Well, my A.ui file refers to mywidget and uic automagically inserts
'#include "mywidget.h" to ui_A.h so mywidget .h is indirectly included in
the A.cpp file.
>
> I agree that ui_x.h files generated by UIC contains complete class along with
> member function definations however again they are included in the source
> files or they will not work
>
> Sorry if I have interpreted your problem incorrectly.
I think you got it right, but I think there is a problem or limitation
in qmake re this usage.
Thanks for looking.
br Kusti
More information about the Qt-interest-old
mailing list