Qmake in windows?

  • I've tried my best to get qmake to work in both windows and mac but nothing worked. Unfortunately, qt has no installation steps for qmake. This is what I did
    First, I installed qt (no problems). It seems that qt doesn't include the path of the proper bin folder in environment variables in windows, so I did include that however I'm not sure which the proper folder to get qmake to work. qmake.exe appears in many folders and one of them is
    After adding it, Visual Studio command prompt recognizes qmake command. So far so good. The next step I did follow qmake tutorial and I did the following
    I've created four files

    @#include "hello.h"

    int main()
    return 0;

    @#include <iostream>
    #include "hello.h"

    void print()
    std::cout << "QMake!" << std::endl;

    @#ifndef HELLO_H
    #define HELLO_H

    void print();


    @CONFIG += debug
    HEADERS += hello.h
    SOURCES += hello.cpp
    SOURCES += main.cpp@

    I opened visual studio command prompt and I typed (as the documentation says)

    qmake -o Makefile hello.pro

    This line created the following files
    debug folder
    release folder

    Now, I invoked nmake to create the executable file


    @Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
    Copyright (C) Microsoft Corporation. All rights reserved.

        "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\nmake.exe" -

    f Makefile.Debug

    Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
    Copyright (C) Microsoft Corporation. All rights reserved.

        cl -c -nologo -Zm200 -Zc:wchar_t -Zi -MDd -GR -W3 -w34100 -w34189 -EHsc

    NGLE -I"........\Qt\5.1.1\msvc2010\include" -I"........\Qt\5.1.1\msvc2010
    include\QtGui" -I"........\Qt\5.1.1\msvc2010\include\QtANGLE" -I"........
    Qt\5.1.1\msvc2010\include\QtCore" -I"debug" -I"........\Qt\5.1.1\msvc2010\mks
    pecs\win32-msvc2010" -Fodebug\ @C:\Users\CroCo\AppData\Local\Temp\nmDBB0.tmp
    Generating Code...
    if not exist debug\hello.exe if exist debug\hello.exe.embed.manifest del
    if exist debug\hello.exe.embed.manifest copy /Y debug\hello.exe.embed.ma
    nifest debug\hello.exe_manifest.bak
    DEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.
    0' publicKeyToken='6595b64144ccf1df' language='
    ' processorArchitecture='*'" /MA
    NIFEST /MANIFESTFILE:debug\hello.exe.embed.manifest /OUT:debug\hello.exe @C:\Use
    if exist debug\hello.exe_manifest.bak fc /b debug\hello.exe.embed.manife
    st debug\hello.exe_manifest.bak >NUL || del debug\hello.exe_manifest.bak
    if not exist debug\hello.exe_manifest.bak rc.exe /fodebug\hello.exe_mani
    fest.res debug\hello.exe_manifest.rc
    Microsoft (R) Windows (R) Resource Compiler Version 6.1.7600.16385
    Copyright (C) Microsoft Corporation. All rights reserved.

        if not exist debug\hello.exe_manifest.bak link /NOLOGO /DYNAMICBASE /NXC

    t.Windows.Common-Controls' version='' publicKeyToken='6595b64144ccf1df' l
    anguage='' processorArchitecture=''" /MANIFEST /MANIFESTFILE:debug\hello.exe.e
    mbed.manifest /OUT:debug\hello.exe @C:\Users\CroCo\AppData\Local\Temp\nmE7C2.tmp

        if exist debug\hello.exe_manifest.bak del debug\hello.exe_manifest.bak


    in debug folder there is hello.exe but the problem it doesn't work. Every time I run it nothing happens.

    What I'm missing here?

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    On Windows, you should rather use Qt Creator to get started. Command line work like that is not especially user/developer friendly on that platform.

  • Hi SGalst, thanks for being informative and helpful. I found the problem it was in hello.pro. The setting in qmake tutorial in the documentation was very poor and messed up. I was following the documentation literally and no luck until I opened the Qt creator to see the proper setting for the source project. once I pasted them, qmake generated the proper files.
    Why I'm using qmake? It is a good question. I want to read the entire documentation and understand them properly. I'm doing my graduate study, so I want to make qt my choice to build my projects.
    Thanks again.

  • Lifetime Qt Champion

    You're welcome

    QtCreator also uses qmake but like I said Windows is not really designed for command line development especially if you're starting there. You should rather use Linux/OS X for that. If not installed on the machine, in a virtual one it'll be fine. If you plan going cross-platform (including embedded/mobile) you should really consider using a unix like OS since most of the available platforms are running on them and also most of the tools are already natively available.
    Don't get me wrong, I don't say that you can't do it on Windows, but you should rather use Creator if you're starting, in order to get to the interesting stuff faster. If you really want to go low level, then *nix is IMHO a better choice.

  • Thanks again for the invaluable advice. I'll keep this in mind.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.