Saturday, 8 November 2008

Qmake, Qt & Polyworld

I've been working with a program called Qmake. It's been an intersting learning experience. I spent a long time trying to build Qt on Windows and being thwarted by the message:

"Invald option "win32-msvc2005" for -platform"


"Unable to detect the platform from environment. Use -platform comman line argument or set the QMAKESPEC environment variable and run configure again."

First off, I'll talk about Qmake and Qt 4.3.1 on Windows.

When you use Qmake and Qt 4.3.1, you need to check in the directory "Qt\mkspecs\" whether there are appropriate mkspec instructions for your platfrom and compiler. For example, when I work on Windows I use MinGW and when I work on Linux I use g++. The mkspecs instructions I need are:
  • linux-g++
  • win32-g++
To build Qt in Windows, you should go to the command line via:

"start ->
Programs ->
Qt by Trolltech v4.3.1 (OpenSource) -> Qt 4.3.1 Command Prompt"

This will set up your PATH and the environment variables QTDIR and QMAKESPEC. You can then just run "configure" and "make". Nice.

You can also choose to go to the command prompt via:

"start ->
Run ->

However this means you'll need to set up your PATH environment variable and when you run you'll need to add some extra variables.

To set up your PATH:


To run configure:

"configure -platfrom win32-g++"

Next, I'll talk about Qmake and Qt 4.3.2 on Windows.

From Qt 4.3.2 onwards, the awesome team Trolltech added support for various versions Microsoft Visual Studio, including 2005.

To configure Qt 4.3.2 for Visual Studio 2005:

"configure -platform win32-msvc2005"

Next, I'll talk about Qmake and Polyworld.

At the moment, Polyworld only works on Linux and Mac. To build Polyworld on Linux you type:


and then


Here Qmake uses I am assuming ".pro" files for instructions. Polyworld comes with "" and "". My guess is that qmake uses

The reason this knowledge is useful is because if you want to build Polyworld in an program such as Code::Blocks you can point Code::Blocks to the "Makefile" generated by Qmake instead of setting up all the options yourself, which I still don't know how to do.

A Few More Takeaways
  • You can keep multiple versionsof Qt around so don't delete them because they take ages to build and you may need to switch between versions.
  • There are bugs in Qt 4.4.0 onwards at least to 4.4.3 that prevent it working with Polyworld.

No comments:

Post a Comment