Compiling with Windows
My company needs some small applications for our customers, so last weekend I started some Qt4-applications. We need them to run with Microsoft Windows, so I removed the dust from my Windows Vista and started installing things. I must say it takes a while to get the hang of Windows again. Annoying is that stuff is not in the path on the command line.
After installing a subversion client to check out the sources, after that installing Vim for Windows. And after that I needed Qt and a compiler and stuff. Fortunately, the Qt windows installer asks if you want to install the ‘compiler and stuff’ part. So it installs everything is needed. Trolltech did a good job there.
After that qmake and make works without problems. That is, there is no debug output printed to the console. You need a separate application ‘debugview’ which shows you all the output. Now I’m recompiling Qt with debug symbols, so that will take a bit. If you are using Vista, you need to add ‘SET PATH=%PATH%;C:\MinGW\libexec\gcc\mingw32\3.4.2′ to your qtvars.bat, else it will fail with can not find cc1 error.
I’m still fighting with QProcess, which seems to have his own ideas about quoting and escaping. Combined with an application which has his own ideas about detecting stdin, I’m having fun tackling this. It will take me a couple of days to get it right probably.
It’s great to be able to create open source applications on Windows.
I love these articles, I am struggling myself.
I hope one day compiling on windows will be super easy, as it is right now on Linux
If you add CONFIG+=console, you will have the debug messages printed on the console. You might want to enable this only on a debug build.
On windows, there are “modes” (subsystem) in which apps work – console mode, GUI mode, driver mode and so on.
On Windows, important things to remember when building with CONFIG+=console are,
1. Unlike GUI mode, making your app a “console” app automatically gives it the stdin/stdout handles. So you might have surprises when running your app in release (especially since you are debugging stuff related to stdin).
2. Session management for console and ui apps are different. In fact, Qt does not support session management with console apps (little known Qt intricacy).
You can use “CONFIG += console” in the .pro file to get the output of qDebug() directly to the console.
The output in a seperate window is not that bad, you just need to get used to it I guess. Although clearing it automatically between restarts of the application would be nice ;-)
I wrote down a list of useful software when working on windows and coming from Linux. Might be useful for you too:
http://www.freehackers.org/Surviving_on_Windows
There is some terminal where you can directly see the debug output.
Not quite sure, I think it was rxvt from cygwin (or mingw ?) or something like this.
Alex