Installing Qt 4.0 on Windows

05Jul05

For anyone who’s tried installing Qt4 on Windows you’ll no doubt have had a few problems. Here’s the steps I had to go through to get it working…

  • Make sure you have MinGW installed. I’m using version 4.1.0.
  • Download the file qt-win-opensource-desktop-4.0.0.zip from Trolltech’s website
  • Extract it to the directory where you want to install Qt, e.g. c:\qt\4.0.0
  • Open a command prompt and cd to the directory c:\qt\4.0.0
  • Run the configure program like this, configure -platform win32-g++. You have to use the win32-g++ platform (MinGW) because win32-msvc (MS Visual Studio) is not supported in the open source version of Qt (see here for a lively debat on the topic). If you try running configure -platform win32-msvc you’ll get to accept the license agreement but the configure program will just exit straight away with no explaination of what happened
  • Ensure that the MinGW bin directory is in your PATH environment variable. It’s very important that if you have MSYS installed that it is NOT in your PATH. If it is then the next step will fail because it picks up the cd program from MSYS and fails when trying to cd to windows formatted paths (i.e. paths using \ instead of /)
  • Run mingw32-make. Note that this step takes quite some time (> 1 hour). Note also that you’ll need at about 2GB of disk space to hold all the files built as part of this step.
  • Finally add c:\qt\4.0.0\bin to your PATH environment variable. Ensure also that MinGW is on your PATH so that the Qt applications can find the MinGW binaries at runtime.
  • coolarm
    Hello, how would I install qt with freetype libraries so that I can use -llibfreetype option when compiling a source code?
  • Benpietras
    Hi, this guide is still good - but now needs a small fix.

    With the open source Qt 4.5.2 the make fails at libQtWebKitd4.a

    You need to delete src/3rdparty/webkit/WebCore/tmp/moc/{debug,release}_shared/mocinclude.tmp

    [Credit http://lists.trolltech.com/pipermail/qt-interes...
  • threaderslash
    Thnx man!

    Specially about:
    "[It’s very important that if you have MSYS installed that it is NOT in your PATH.]" It was what blocked my installation for hours.

    Cheers....|:0),
  • ibrahim
    Thanks a lot , I try to compile qt with visual studio as QT web site tell me but it does not work as you tell us , and your way is the excellent way and work right , thanks a gain , If you have additional information about this operation , tell us , thanks...............
  • Cmaity
    Thanks a lot. after 8 months I got something real and working.

    I tried all permutation and combinations. All were fail.
    Now its excellect. its working.
    remamber all, set the path.
    The way of setting path in winXP:
    Right click "My computer" -> properties -> advance -> set environmental vriable

    Edith the path parameters by adding "C:\minGW\bin".

    Regards,
  • hamraj shende
    how do i move ahead if configure fails????
  • i downloaded qt. opensource.4.4.3 now i am getting same problem og mingw-32 -make problem ................. plz help.
  • F
  • when i did the mingw32-make it only take a few minutes and had erros related with visualc and with \bin\moc.exe. Then i tried qmake -project (ok) , then the qmake file.pro (ok) when i type make i had a error, something like cannot find -lqtguid4
    Please help
  • lien
    I just add C:\MinGW in my PATH so i met that errors. When i add C:\MinGW\bin, everything is good.

    Thankyou for your guide.
  • lien
    i added MinGW bin directory in my PATH environment variable, but i see some messages:
    Creating qmake...
    execute: File or path is not found
    execute: File or path is not found
    cleaning qmake failed, return code -1

    Please help me!
  • Niki RCN29
    THANK YOU SOOO MUCH!

    Finally I made it!
    I'm so happy too have found the link to this page!

    Now i'm able to build Qt projects at last!

    Really THANK YOU VERY MUCH!
  • Jack Gold
    What if the configure fails?
blog comments powered by Disqus