Thursday, September 24, 2009

Building Qt4 for Windows using MSVC 2008

  1. Make directories C:\Qt\src and C:\Qt\build (the build procedure really doesn't like fancy paths, so do use something this simple)
  2. Download and unzip Qt Open Source SDK to C:\Qt\src
  3. Copy C:\Qt\src\qt\mkspecs C:\Qt\build\
  4. Open your Visual Studio Command Prompt
  5. $ "bin\vcvars32.bat"
  6. $ cd C:\Qt\src
  7. $ bin\qtenv.bat
  8. $ cd qt\
  9. $ configure -opensource -platform win32-msvc2008 -prefix C:\Qt\build
  10. $ nmake
  11. $ nmake install
  12. set QTDIR=C:\Qt\build
note: Qt will hard-code the prefix path into it's binaries. It cannot be relocated in the file-system.
note: if you get link errors warning about inability to find MOC-related problems (mine was in WebCore), you may want to delete the mocinclude.tmp file (src/3rdparty/webkit/WebCore/tmp/moc/{debug,release}_shared/mocinclude.tmp).

1 comment:

RobBrown said...

Thanks for this, it got me going when I was well stumped!
On my install (2009.04 version of the Qt SDK), qtenv.bat clobbered the pre-existing path and so nmake wasn't found. The solution was, of course, to simply run the vcvars batch file *after* qtenv.