This procedure will build static Qt which takes hours; you've been warned.
Solved problem 1: On Windows 7 with Cygwin installed you might get this error:
make (e=5): Access is denied.
mingw32-make: *** [project.o] Error 5
Building qmake failed, return code 2
That is because g++.exe file is probably restricted for your user. Go to C:\cygwin\bin\g++ file (or wherever you had installed Cygwin) and set access rights: Properties -> Security -> Edit -> [Your username] -> Check Full Control
Solved problem 2: Furthermore, if you're running 64 bit version of Windows with Cygwin you will receive this message:
This version of c:\cygwin\bin\g++.exe is not compatible with
the version of Windows you're running. Check your computer's system
information to see whether you need a x86 (32-bit) or x64
(64-bit)version of the program, and then contact the software publisher.
And then following lines as a result of configuring Qt:
make (e=216): Error 216
mingw32-make: *** [project.o] Error 216
Building qmake failed, return code 2
The solution I found was to temporarily rename the g++.exe file in Cygwin folder so that it can't be reached for the time building Qt library, since Qt comes with it's own g++ anyway.
While you're at it, to the same for gcc also.
Previous:
Qt doesn't display Jpg and Gif files in release built on Windows
Next:
How to implement loop feature in libVLC play video with Qt in c++