Warning: No relevant classes found. No output generated.
I work on an application that runs both on a desktop PC and an embedded device. A few classes of the application are only relevant for the desktop version, but overall, I use the same code base and the same .pro file (with a couple of switches to distinguish between platforms, of course).
In order to hide a class that's not needed on the embedded device, I completely enclose it (both declarations in the header and definitions within the cpp file) with
#endif // Q_WS_QWS@
When compiling for the embedded device, I get the warning:
bq. Warning: No relevant classes found. No output generated.
Yes, the message is correct. I know, and this is how it should be. How do I turn it off?
I found a few forum entries suggestion I remove such files from the HEADERS section of the .pro file. It strikes me as strange, because after all, the .pro file must contain all source files that need to be compiled.
...and I certainly don't want to maintain two separate .pro files for desktop and embedded.
You can use conditionals in your .pro files as well.
Is the Q_WS_QWS-define already set by the time the .pro file is parsed?
No, but qmake understands various other scopes. Take a look at the qmake documentation or just take a look at "Qt itself":http://qt.gitorious.org/qt/qtbase/blobs/master/src/corelib/kernel/kernel.pri#line42 where scopes are used a lot.
The issue I have with those scopes is that they are very poorly documented, if at all. For example, I have seen an "embedded" scope used in Qt's .pro files. Is it comparable to Q_WS_QWS? Will it be set in all the cases where Q_WS_QWS is set?
My code relies that the class exists if
using a qmake-level scope that does anything but provide the exact same behavior sounds like asking for trouble.
Well, using scopes is what Qt itself uses. You'll have to for Q_OBJECTS that are different for desktop and embedded, as moc itself does not understand precompiler directives.
qmake documentation definitly would need some love. The thing with scopes is that there are a lot of things which can be used as a scope condition, including various compiler- and platform-specific options - compiling and maintaining such a list would be quite a task.
A short summary recited from mind, which should cover almost all usual possibilities and use cases:
- win32, macx, unix
- everything from $QTDIR/mkspecs, for example linux-g++ or qws
- everything listed in CONFIG, for example shared or debug
Also keep in mind that scopes allow for negation and nesting, fo example !win32.
Thanks! Your short list is a better documentation than anything I have found so far.
"qws" sounds promising, maybe this is exactly what I need.