Qt/Windows & VC++ 2008 Express

In this part I'll show how to build Qt4 with MS Visual C++ 2008 (9.0) Express  ( yes, it out there Open-mouthed ) :

Requirement:
  1. MS Visual C++ 2008 (9.0) Express
  2. Qt/Windows Open Source Edition (.Zip version )
 
Steps:
  • decompress the file to folder of your choose let refer it as QtSourcee.g:
    • C:/QtSource/

Update: From "Visual Studio 2008 Command Prompt":

  • now execute "configure.exe" , to prepare the source
    • C:/QtSource> configure
       

configure

  • now run 'nmake" command , to compile the source ( it will take long time , 1 hour - 4 hours) :
    • C:/QtSource> nmake

Building 

  • At thing point, you have almost everything ready  Open-mouthed ,  now have a fun playing with the the  demos  ( QtSource/bin/qtdemo.exe ):
    • C:/QtSource> cd bin
    • C:/QtSource> qtdemo

Demos

 
Environment Configuration:

Assumptions:

  •  
    • Qt bin folder --> C:/QtSrouce/bin
    • Qt lib folder --> C:/QtSrouce/lib
    • Qt Headers folder --> C:/QtSource/include

System configure:

  1. Open My Computer -> Properties -> Advanced -> Environment Variables
  2. Add new variable QTDIR as follows :

    • QTDIR=C:/QtSource

  3. Edit PATH variable by appending the  following path:
  •  
    • ;%QTDIR%/bin

 

VC++ configure:   (Tool -> Options , in VC++ Directories)

  • Show directories for: Include files:  

$(QTDIR)/include

Include files

  • Show directories for: Library files:

$(QTDIR)/lib

Library files

That's all for now Open-mouthed

Similar Posts

  1. CMake & Qt4 (Q3Support)
  2. CMake & Qt4 Modules
  3. Jawalnet -> The page cannot be found !

COMMENTS

  • jaime on on 10.03.2008 at 10:45 PM

    jaime avatar

    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

    da-crystal avatar

    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

    suresh avatar

    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="&quot;$(QTDIR)/include&quot;;&quot;$(QTDIR)/include/QtGui&quot;"

    />

    <Tool

    Name="VCLinkerTool"

    AdditionalDependencies="QtCore4.lib QtGui4.lib"

    AdditionalLibraryDirectories="&quot;$(QTDIR)/lib&quot;"

    />

    <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

    jaime avatar

    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

    da-crystal avatar

    @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 ;)

  • Seth on on 1.26.2009 at 12:55 PM

    Seth avatar

    Hi, I've followed your tutorial and set everything up as you've stated. In the cmd prompt i can execute "where QtCore4.dll" and get the correct path. When i try and compile a simple test program though,

    #include <QApplication>

    #include <QPushButton>

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

    {

    QApplication app(argc, argv);

    QPushButton hello("Hello world!");

    hello.show();

    return app.exec();

    }

    this is what it spits out:

    1>------ Build started: Project: Test, Configuration: Debug Win32 ------

    1>Compiling...

    1>Test.cpp

    1>c:/users/seth/documents/visual studio 2008/projects/test/test/test.cpp(1) : fatal error C1083: Cannot open include file: 'QApplication': No such file or directory

    1>Build log was saved at "file://c:/Users/Seth/Documents/Visual Studio 2008/Projects/Test/Test/Debug/BuildLog.htm"

    1>Test - 1 error(s), 0 warning(s)

    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

    not really sure what I'm doing wrong.

  • da-crystal on on 1.26.2009 at 3:54 PM

    da-crystal avatar

    Hi Seth,

    try to change:

    #include <QApplication>

    #include <QPushButton>

    To:

    #include <QtGui/QApplication>

    #include <QtGui/QPushButton>

    Or you can add Qt-modules-include-path to VC++ Environment. To do so,just repeats the steps for configuring "$(QTDIR)/include" to add the following:

    * $(QTDIR)/include/QtCore

    * $(QTDIR)/include/QtGui

    Hopping this will solve yours.

    Regards,

  • Seth on on 1.26.2009 at 11:57 PM

    Seth avatar

    Thanks for the quick response, my one error turned into 10...

    it looks like they are all linker errors.

    error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall QApplication::~QApplication(void)" (__imp_??1QApplication@@UAE@XZ) referenced in function _main

    they all look something like this.

    Thanks again for the help.

  • da-crystal on on 1.27.2009 at 8:29 AM

    da-crystal avatar

    Thats normal :D, you just need to specify Qt's linking libraries(depends on what Qt modules you are using).

    For your earlier code, you need to link to:

    * QtCore4.lib

    * QtGui4.lib

    To do so, from project properties:

    Configuration Properties --> Linker --> Input --> Additional Dependencies --> add "QtCore4.lib QtGui4.lib" to what you have in there

    Anyway, CMake very handy when dealing with Qt configuration specially when using non-default-Qt-modules(other than QtCore & QtGui).

    Regards,

  • da-crystal on on 1.27.2009 at 8:33 AM

    da-crystal avatar

    Btw, have a look to the 3rd comment (by suresh) it a very convenience way to configure you Qt projects.

  • Seth on on 1.27.2009 at 10:18 AM

    Seth avatar

    Thanks a million! I finally got it to work.

  • Seth on on 1.27.2009 at 10:27 AM

    Seth avatar

    Now, if I could only figure out why on some eclipse with QT installed I get No Binaries problems and in other places with QT installed with eclipse everything runs the way it should, I would be perfect.

  • radu on on 2.09.2009 at 12:32 AM

    radu avatar

    Thanks man! The last one with the linker solved my problems. Thanks a lot!

  • Jorge on on 4.30.2009 at 10:38 PM

    Jorge avatar

    Hi i'm Jorge

    my application works fine but when i build it, vsc++ 09

    show this warning

    applicationname.exe not found or not built by the last incremental link; performing full link

    qtmaind.lib(qtmain_win.obj) : warning LNK4099: PDB 'vc90.pdb' was not found with 'C:/QT/lib/qtmaind.lib' or at 'c:/Visual Studio 2008/Projects/applicationname/Debug/vc90.pdb'; linking object as if no debug info

    i can't run this .exe in others computers, i need help, thx.

  • Bisnis Online Internet on on 5.06.2009 at 12:36 PM

    Bisnis Online Internet avatar

    Very useful information, thank

  • ricky on on 5.10.2009 at 3:55 AM

    ricky avatar

    thanks for informing

  • free ebook on on 5.18.2009 at 8:26 PM

    free ebook avatar

    Excellent post thanks for sharing

  • Armoric on on 5.22.2009 at 3:11 AM

    Armoric avatar

    Hi, and thanks for the very useful infomation.

    I am having the same kind of link errors than Seth (on 8th comment) and though I followed all of the advices given there I keep getting the same 3 links errors :

    1>qtmain.lib(qtmain_win.obj) : error LNK2019: symbole externe non résolu "__declspec(dllimport) public: void __thiscall std::locale::facet::_Register(void)" (__imp_?_Register@facet@locale@std@@QAEXXZ)

    référencé dans la fonction "class std::ctype<char> const & __cdecl std::use_facet<class std::ctype<char> >(class std::locale const &)" (??$use_facet@V?$ctype@D@std@@@std@@YAABV?$ctype@D@0@ABVlocale@0@@Z)

    1>qtmain.lib(qtmain_win.obj) : error LNK2019: symbole externe non résolu "__declspec(dllimport) public: static unsigned int __cdecl std::ctype<char>::_Getcat(class std::locale::facet const * *)" (__imp_?_Getcat@?$ctype@D@std@@SAIPAPBVfacet@locale@2@@Z)

    référencé dans la fonction "class std::ctype<char> const & __cdecl std::use_facet<class std::ctype<char> >(class std::locale const &)" (??$use_facet@V?$ctype@D@std@@@std@@YAABV?$ctype@D@0@ABVlocale@0@@Z)

    1>qtmain.lib(qtmain_win.obj) : error LNK2019: symbole externe non résolu "__declspec(dllimport) public: static unsigned int __cdecl std::ctype<unsigned short>::_Getcat(class std::locale::facet const * *)" (__imp_?_Getcat@?$ctype@G@std@@SAIPAPBVfacet@locale@2@@Z)

    référencé dans la fonction "class std::ctype<unsigned short> const & __cdecl std::use_facet<class std::ctype<unsigned short> >(class std::locale const &)" (??$use_facet@V?$ctype@G@std@@@std@@YAABV?$ctype@G@0@ABVlocale@0@@Z)

    I saw on a forum a guy with the same problem as me, and exactly the same code (ie we just created a new project and tried to compile it without adding anything), he said he resolved his problem the following :

    "got Desktop -> Systray first, compile it without Config += console in the project file and it gives exactly 3 linking errors. When i enable console, its linking ok."

    Well, I'm quite noob at VC/Qt (and C+ as well but this time I didn't code anything) but if I'm not mistaken, project files are .vcproj files, looking a little bit like xml syntax ?

    I'm confused by the advice, not knowing where exactly I should put that "config += console" thing to try it out. Could someone give precise indications ?

  • Sulumits Retsambew on on 6.02.2009 at 10:05 PM

    Sulumits Retsambew avatar

    thanks for this nice info sir!

  • robert on on 6.15.2009 at 2:19 AM

    robert avatar

    great post, thanks a lot..

  • Rusli Zainal Sang Visioner on on 6.15.2009 at 1:53 PM

    Rusli Zainal Sang Visioner avatar

    Very nice discussion, i get a new things from here. thanks a lot.

  • Stop Dreaming Start Action on on 6.20.2009 at 10:31 AM

    Stop Dreaming Start Action avatar

    Nice post! very interesting topic. keep on posting.

  • Jorge ferrera on on 6.22.2009 at 6:13 PM

    Jorge ferrera avatar

    Hi,

    I have to put another lib to qt works with me, I put qtmain.lib in "Additional Dependencies" too

    In other words, put

    * QtCore4.lib

    * QtGui4.lib and qtmain.lib, boys ;)

    hugs.

  • moving company on on 6.26.2009 at 3:49 PM

    moving company avatar

    how far can we go together?

  • denver movers on on 6.26.2009 at 3:49 PM

    denver movers avatar

    how lovely it is?

  • San Francisco Movers on on 6.26.2009 at 3:50 PM

    San Francisco Movers avatar

    can it be better now?

    donno?

    cant believe it

  • listerine toenail fungus on on 7.10.2009 at 3:45 AM

    listerine toenail fungus avatar

    Wow..nice tips on how to build Qt4 Thanks for sharing

  • Blogger Tutorial on on 7.15.2009 at 1:47 PM

    Blogger Tutorial avatar

    thanks for share this, but I think need more experience for me to do this :(

  • online phd degree on on 7.17.2009 at 12:34 PM

    online phd degree avatar

    I think need more experience for me to do this :(

  • online Master Degree on on 7.17.2009 at 12:35 PM

    online Master Degree avatar

    Wow..nice tips on how to build Qt4 Thanks for sharing

  • distance learning university on on 7.17.2009 at 12:37 PM

    distance learning university avatar

    how to build Qt4 Thanks for sharing

  • college degree on on 7.17.2009 at 12:37 PM

    college degree avatar

    how far can we go together?

  • online Bachelor Degree on on 7.17.2009 at 12:37 PM

    online Bachelor Degree avatar

    lib to qt works with me, I put qtmain.lib in "Additional Dependencies" too

POST A COMMENT

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值