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
C:\Qt\5.1.1\msvc2010\bin
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
hello.cpp
hello.h
main.cpp
hello.pro

main.cpp
1
2
3
4
5
6
7
#include "hello.h"

int main()
{
	print();
	 return 0;
}


hello.cpp
1
2
3
4
5
6
7
#include <iostream>
#include "hello.h"

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


hello.h
1
2
3
4
5
6
7
#ifndef HELLO_H
#define HELLO_H

void print();


#endif 


hello.pro
1
2
3
4
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
Makefile
Makefile.debug
Makefile.Release

Now, I invoked nmake to create the executable file
>nmake

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
-DUNICODE -DWIN32 -DQT_GUI_LIB -DQT_CORE_LIB -DQT_OPENGL_ES_2 -DQT_OPENGL_ES_2_A
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
hello.cpp
main.cpp
Generating Code...
        echo 1 /* CREATEPROCESS_MANIFEST_RESOURCE_ID */ 24 /* RT_MANIFEST */ "de
bug\\hello.exe.embed.manifest">debug\hello.exe_manifest.rc
        if not exist debug\hello.exe if exist debug\hello.exe.embed.manifest del
 debug\hello.exe.embed.manifest
        if exist debug\hello.exe.embed.manifest copy /Y debug\hello.exe.embed.ma
nifest debug\hello.exe_manifest.bak
        link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:WINDOWS "/MANIFEST
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
rs\CroCo\AppData\Local\Temp\nmE255.tmp
        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
OMPAT /DEBUG /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsof
t.Windows.Common-Controls' version='6.0.0.0' 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?


Are you running "hello.exe" from the command line? This should work, and what your problem might be is that your program is opening and closing too fast for you to see.

On the other hand, if you are getting an error (such as "cannot find QtCore.dll" or something like that), copy the DLLs it asks for from the "bin" folder of your Qt folder until it runs.
Yes, I'm running hello.exe from the command line. ti doesn't work. I'm not getting any error.
You have /SUBSYSTEM:WINDOWS when you invoke link.exe, that will not give you a console application (does not even seek for main() entry point.)

Use /SUBSYSTEM:CONSOLE instead, see Microsoft documentation.
http://msdn.microsoft.com/en-us/library/fcc1zstk(v=vs.100).aspx
@modoran,
thanks for the info. Actually the problem was the qt documentation. qmake tutorial was very bad organized tutorial. The problem was the following hello.pro
1
2
3
4
CONFIG += debug
HEADERS += hello.h
SOURCES += hello.cpp
SOURCES += main.cpp


is incorrect. Surprisingly, this is what the documentation suggests.
Topic archived. No new replies allowed.