Complete guide for Installing and Running your first GUI Application in Qt c++ in Windows 7 (for Newbies)

Qt is a cross-platform application and UI framework. Using Qt, you can write web-enabled applications once and deploy them across desktop, mobile and embedded operating systems without rewriting the source code.

Recently I installed Qt 4.5.2 on my Windows 7 PC and had some minor installation and post-installation issues which I shall discuss here.

Step 1.

Download Qt SDK: Follow this link to download

Qt is available for download as a free 30-day commercial evaluation, or under the LGPL open source license. Choose whichever license you want. However, every time you build projects using commercial edition Qt will display a license popup.


Step 2.

Install Qt to whichever directory you want. Like i installed it at C:\Qt\2009.03\ . This path will be needed later.

Step 3.

Write a simple Qt-c++ program like the one given below just so that we can use it to test if the installation is properly done and the environment variables are properly set. Just write this piece of code in notepad and save it as HelloQt.cpp in a directory HelloQt. Remember the path since it will be used later.

#include <QtGui/QApplication>


int main(int argc, char *argv[])


QApplication app(argc, argv);

QLabel *label = new QLabel(” Hello Qt!”,0);


return app.exec();


Step 4.

Setting Environment variables.

  • From the desktop, right-click My Computer and click Properties.
  • In the System Properties window, click on the Advanced tab.
  • In the Advanced section, click the Environment Variables button.
  • Finally, in the Environment Variables window (as shown below), highlight the Path variable in the Systems Variable section and click the Edit button. Add or modify the path lines with the paths you wish the computer to access. Each different directory is separated with a semicolon as shown below.
  • Environment

    Append the following variable value to Path : C:\Qt\2009.03\bin; C:\Qt\2009.03\qt\bin

    Note that the above Path depends on the directory where Qt was installed previously, like mine was C:\Qt\2009.03\.

    Step 5.

    Open Qt command prompt which is installed along with Qt and has a shortcut in Start-menu.

    qt command prompt

    Step 6.

    Change directory to where you have saved HelloQt.cpp in your system.

    cd C:\QtProj\HelloQt

    Step 7.

    Type the following commands …

    qmake –project




    The first command will generate a .pro file (

    The next command will generate a MakeFile for your project

    Finally nmake shall create a .exe file of your project and the .exe shall be saved inside either the debug or the release folder by the name HelloQt.exe


    Problem with using nmake command

    If windows shows some error like “nmake is not a recognised internal or external command”, this means nmake is not installed on your system. To install, you need to downloading, extract, and place two files into your C:\WINDOWS\system32 or C:\WINDOWS\ folder.

    Follow the steps below to install nmake on your PC

    1. Download nmake : Use this link or Google nmake15.exe if this links is broken –
    2. Extract nmake: Run the Nmake15.exe file which will extract two files to the directory where it is located. These files will be nmake.exe and NMAKE.ERR.
    3. Now move those two extracted files to C:\WINDOWS\system32.

    This should install nmake on your system.

    If you follow the above steps correctly, you are ready to use Qt to create GUI applications on your Windows PC.



    1. good Post!!! nice work :)

    2. Thank you =)

    3. ————Edit———–For those who face the error mingwm10.dll not foundDownload the following and place in system32 folder :

    4. You post interesting posts here. Your website deserves much more traffic.
      It can go viral if you give it initial boost,
      i know very useful tool that can help you, just search in google: svetsern traffic tips

    Leave a Reply

    Fill in your details below or click an icon to log in: Logo

    You are commenting using your account. Log Out / Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out / Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out / Change )

    Google+ photo

    You are commenting using your Google+ account. Log Out / Change )

    Connecting to %s

    %d bloggers like this: