Qt/Windows & VC++ 2008 Express - Part1
In this part I'll show how to build Qt4 with MS Visual C++ 2008 (9.0) Express ( yes, it out there
) :
Requirement:
- MS Visual C++ 2008 (9.0) Express
- Qt/Windows Open Source Edition (.Zip version )
Steps:
- decompress the file to folder of your choose let refer it as QtSource e.g:
- C:\QtSource\
Update: From "Visual Studio 2008 Command Prompt":
- now execute "configure.exe" , to prepare the source
- C:\QtSource> configure
- C:\QtSource> configure
- now run 'nmake" command , to compile the source ( it will take long time , 1 hour - 4 hours) :
- C:\QtSource> nmake
-
At thing point, you have almost everything ready
, now have a fun playing with the the demos ( QtSource\bin\qtdemo.exe ):- C:\QtSource> cd bin
- C:\QtSource> qtdemo
Environment Configuration:
Assumptions:
- Qt bin folder --> C:\QtSrouce\bin
- Qt lib folder --> C:\QtSrouce\lib
- Qt Headers folder --> C:\QtSource\include
System configure:
- Open My Computer -> Properties -> Advanced -> Environment Variables
-
Add new variable QTDIR as follows :
-
QTDIR=C:\QtSource
-
- Edit PATH variable by appending the following path:
- ;%QTDIR%\bin
VC++ configure: (Tool -> Options , in VC++ Directories)
- Show directories for: Include files:
$(QTDIR)\include
- Show directories for: Library files:
$(QTDIR)\lib
That's all for now ![]()

Comments
jaime on on 10.03.2008 at 10:45 PM
hi man! thank u for this post but i still have a problem with:
3. Edit PATH variable by appending the following path:
;%QTDIR%\bin
i dont get it! what i do in here! then the examples r working good but the compiler dont let me execute couse dont detect the libs and the includes. please a little help i apreciate it too much
da-crystal on on 10.04.2008 at 4:40 AM
The perpose of step 3 of "System configure", to make QT(dll's) visible to any program that need it.
I'm assuming you have successfully done the other steps because it important.
- Now, in the "Environment Variables" window there are two panels one for user variable and other for system.
- From "System Variables", scroll down, to locate "Path" then double click it or select it then click on "Edit"
- From "Edit System Variable" window, add ";%QTDIR%\bin" at the end of Variable value. make sure you have done step 2 in "System configure"
To double check you configuration,in Command Prompt, execute the following command:
"where QtCore4.dll"
You should get the full path of "QtCore4.dll" as an answer.
Note: sometime(never have) you need to restart your PC to get that in effect.
Also, this may help: www.youtube.com/.../watch
suresh on on 10.20.2008 at 2:32 PM
A small convenience :
Make a Qt property sheet and add to Qt related projects.
Create a file Qt.vsprops and paste following
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioPropertySheet
ProjectType="Visual C++"
Version="8.00"
Name="Qt"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""$(QTDIR)\include";"$(QTDIR)\include\QtGui""
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="QtCore4.lib QtGui4.lib"
AdditionalLibraryDirectories=""$(QTDIR)\lib""
/>
<Tool
Name="VCResourceCompilerTool"
AdditionalIncludeDirectories="$(QTDIR)\include"
/>
<UserMacro
Name="QTDIR"
Value="C:\Qt\4.4.3"
PerformEnvironmentSet="true"
/>
</VisualStudioPropertySheet>
For projects using Qt add above property sheet to project.
View->Property Manager then add this file.
jaime on on 10.21.2008 at 3:02 AM
hi i did what u said, but the error that apears when execute an instance says:
for example for tutorial1 t1.exe
not can find the component
not find QtOpenGLd4.dll. reinstall may help to solve the problem
but i know the installation is fine. couse the qtdemo works, it sopouse that when i build an example in vc++ then i can play a new instance...
or i have to start the instance from console??
da-crystal on on 10.21.2008 at 12:40 PM
@suresh: thanks very much, it is a cool and a smart way :D
BTW, I'm using CMake in all my C++ projects which help in IDE configuration.
@jaime: I think that happen because you are compiling and linking you code in debug mode where your Qt have been compiled as release. In your case, you might re-compile Qt to generate debug files or re-configure the Debug mode to link to Qt's release one.
I hope that will solve it. Waiting your feedback ;)