Windows
Install qt4.5
Installation steps:
1.
Set
Qt-win-opensource-src-4.5.1.zip
Decompress the package to a directory (the path should not contain Chinese characters or spaces to prevent inexplicable problems), such:
C:/QT/4.5/
Or
C:/QT/4.5-msvc2005/(<--
If for instance you plan on using Visual Studio 2005)
2.
Open
Vsvars32.bat
(If
Vs2005
Install
C
Disk,
Vsvars32.bat
In the Directory
C:/Program
Files/Microsoft Visual Studio 8/common7/tools
), Modify the environment variable:
Ü
Set
C:/QT/4.5-msvc2005
Join
Path
Medium
Path = C:/QT/4.5-msvc2005 ;......
Ü
Set
C:/QT/4.5-msvc2005/include
Join
Include
Medium
Include = C:/QT/4.5-msvc2005/include ;... ...
Ü
Set
C:/QT/4.5-msvc2005/lib
Join
Lib
Medium;
Lib = C:/QT/4.5-msvc2005/LIB ;... ...
Set
C:/QT/4.5-msvc2005/bin;
Add system environment variables
Path
, New system environment variable
Qmakespec
, Value
Win32-msvc2005
.
VC
Version and
Qmakespec
Is as follows:
·
Visual
Studio 6.0-> win32-msvc
- Visual
Studio. NET (2003)-> win32-msvc.net
- Visual
Studio 2005-> win32-msvc2005
- Visual
Studio 2008-> win32-msvc2008
Echo % qmakespec %
Check
Qmakespec
Set correctly
3.
Run
Cmd.exe
, Enter the Directory
C:/QT/4.5-msvc2005
, Run in the command line
Vsvars32.bat
At this time, the current command line has been set
Qt
Environment variables required for installation.
Use a simple method to test whether the environment variables have been configured:
C:/QT/4.5-msvc2005> nmake /?
If everything appears
OK
.
4.
C:/QT/4.5-msvc2005> Configure
-Debug-and-release
(You can set the required parameters and execute
Configure.exe
-Help
See parameter description)
Ü
Which
Edition of QT do you want to use?
Business Edition (
Commercial Edition
), Open-source edition (
Open source Edition
) Available. I select the Open Source edition and enter
O
, Press ENTER;
Ü
Do
You accept the terms of the license?
Input
Y
, Press enter to start generating
Qmake
(Wait for a while, about
10
Minutes ).
Qmake-V
Check
Path
Set correctly
5.
Compile
Qt
Library
C:/QT/4.5-msvc2005> nmake
It takes a long time to compile. We recommend that you start compilation before going home from work at night and discover everything early the next day.
OK
This feeling is quite good.
After the compilation is successful, run
Nmake clean
The intermediate file is generated during compilation, and only the folder is left.
770 m
.
6.
Pass
Qmake
Create
Vc2005
Engineering
Now, we can use a small program to enjoy the joy of building the environment:
# Include <qapplication>
# Include <qpushbutton>
Int main (INT argc, char * argv [])
{
Qapplication
APP (argc, argv );
Qpushbutton
Hello ("Hello world! ");
Hello. Resize (400,300 );
Hello. Show ();
Return
App.exe C ();
}
Put in
E
Disk
Hello
Folder (working directory can be arbitrary), and then execute the compilation link process, as follows:
E:/> Hello>Qmake-Project
//
Creates a project file unrelated to the platform.
E:/> Hello>Qmake hello. Pro
//
Create a platform-specific
Makefile
E:/> Hello>Qmake-tp vc hello. Pro
//
Pass
Hello. Pro
Create
VS
Project File
E:/> Hello>Nmake
//
Compile the link Program
In
Xxx. Pro
After the project file, you can execute
Qmake-tp vc xxx. Pro
Generate
VC
Of
Xxx. DSP
File, you can
VC
In progress
Qt
File compilation and operations, it is easy to transplant programs in different systems
Related links:
Http://www.qtnode.net/wiki/Qt4_with_Visual_Studio
Http://sakurasea.com/program/qt4-5-integrate-with-vs2008-vs2005/
Http://blog.sina.com.cn/s/blog_5a8c0abf0100b3qw.html