Wednesday, November 18, 2009

qmake woes

Sorted out my first Qt hurdle

The pdf book doesn't match Qt 4 installation on Mac. PDF was probably not updated since version 3.*.

Lesson learned: When you get an example program, even from a reputable source, if it doesn't work for you, then you might discover that later revisions in the tools make earlier examples non-functional.

code adjustment:

#define QT3_SUPPORT
#include <qapplication.h>
#include <qlabel.h>
int main(int argc, char* argv[])
{
   QApplication app(argc, argv);
   QLabel* label = new QLabel("Hello Qt!", 0);
   app.setMainWidget(label);
   label->show();
   return app.exec();
}


Note: If you have the line QT += qt3support in your .pro file, qmake will automatically define the QT3_SUPPORT symbol, turning on compatibility function support.

and note command line adjustment for MAC:

ergun$ qmake -project
ergun$ qmake -spec macx-g++
ergun$ make

Try examples under
/usr/share/qt4 or /usr/local/Trolltech/Qt-4.2.2

No comments:

Post a Comment