I'm still working on subclassing an external library, and have decided to use preprocessor directives to set my .h file up so the library will work with or without Qt.
For compiling my library without Qt I define a compiler flag -DNOQT.
In my .h file I put
#ifndef NOQT
Q_OBJECT
#else
class Server{
#endif
#ifndef NOQT
class Server: public QObject{
Q_OBJECT
#else
class Server{
#endif
To copy to clipboard, switch view to plain text mode
I can compile this just fine without Qt. But with Qt I get the following errror:
Error: syntax error
When I try the following it works. But of course then I can't compile the library without Qt:
#ifndef NOQT
Q_OBJECT
//#else
//class Server{
#endif
#ifndef NOQT
class Server: public QObject{
Q_OBJECT
//#else
//class Server{
#endif
To copy to clipboard, switch view to plain text mode
Any ideas on fixing this? It would be really great if I could maintain just one .h file.
Bookmarks