Results 1 to 14 of 14

Thread: Installing Qt 4.7 and to Visual Studio 2008

  1. #1
    Join Date
    Oct 2010
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Question Installing Qt 4.7 and to Visual Studio 2008

    I've been trying to get Qt installed and work with Visual Studio 2008 for a while now, to no avail. I would have hoped there would have been a straight forward process for this, but I've not seen one yet, so here's the steps I've done so far.

    My computer is windows XP 64bit SP 2 intel Xeon 2.4Ghz with 8GB ram.

    I've been using the hello world example from here as my test to see if it's been installed correctly yet.

    My single error so far has been:
    c:\%documentslocation%\my documents\visual studio 2008\projects\helloworld\helloworld\helloworld.cpp (7) : fatal error C1083: Cannot open include file: 'qapplication.h': No such file or directory

    First downloaded: http://qt.nokia.com/downloads/sdk-windows-cpp and installed. Which worked by itself, then a little more digging said I had to install the Qt4 Visual Studio Add-in
    http://qt.nokia.com/downloads/visual-studio-add-in
    Configuring that had issues with the MinGW and refused to find it.

    Ok. Then I found these instructions:
    http://ngi-central.blogspot.com/2009...al-studio.html
    So I uninstalled, reinstalled following those steps, deleted the stuff that makes it crash and let it run. It ran all the way up to fatal error U1077 which from here:
    http://msdn.microsoft.com/en-us/libr...8VS.71%29.aspx
    Sounds like it was just trying to close.
    And also set the Path var to include c:\Qt\2010.5\bin\

    Went back to configure the Add-in and it still complained that there was minGW installed. Time for some more digging....

    Then I found a post (which i've closed already) stating that that this version of Qt needed to be installed instead: http://qt.nokia.com/downloads/windows-cpp-vs2008

    So installed that. And then the Qt Add-in automatically found C:\Qt\4.7.0\ folder.
    Still no dice.

    A little more found me here: http://sector.ynet.sk/qt4-tutorial/preparations.html

    So now I have the QTDIR var set to c:\Qt\4.7.0\ and c:\Qt\4.7.0\bin

    All this time I still get the original error stated above.

    Is QT really this hard to install or have I hit the unlucky streak?

    Help please, thanks.

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Installing Qt 4.7 and to Visual Studio 2008

    It's usually easier to start with Qt Creator, at least at the beginning.

    This is how I started:
    o Create project in Qt Creator. Make it do something (open a window, whatever)
    o Install the pre-compiled VS2008 version of the Qt libs in a different dir, so I now have both MinGW as c:\qt\MinGW and VS as c:\qt\VS08
    o Install the Qt Plugin for VS2008
    o Tell the plugin to load the project (.pro) file created by Qt Creator in the first step
    o Clicked "rebuild" and it spat out a working executable
    o Modified from there

    Don't know why, but I've never tried to create a Qt application in VS08 from scratch.

  3. The following user says thank you to squidge for this useful post:

    PatchPaper (4th October 2010)

  4. #3
    Join Date
    Oct 2010
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Installing Qt 4.7 and to Visual Studio 2008

    Thanks, that works.
    Seems rather round about way though. I come from python and pyqt4, and the first thing I learned with pyqt4, was how to build a ui from scratch. Seemed like the simplest way to start with Qt.

  5. #4
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Installing Qt 4.7 and to Visual Studio 2008

    It would probably work straight away if you knew what to use for the default settings (search paths, etc), but rather than remembering them, it's far easier to just import a known working project.

  6. #5
    Join Date
    Aug 2009
    Location
    Belgium
    Posts
    310
    Thanks
    10
    Thanked 31 Times in 25 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Installing Qt 4.7 and to Visual Studio 2008

    Hi,

    If you're not bound to Visual Studio, I would advise to just stay with QtCreator.

    Maybe you are used to Working with Visual Studio, and it is your favourite editor. In that case I understand that you would want to stick with VS. But otherwise there is no reason to use VS. QtCreator is a great environment for developing Qt applications.

    Of course you can still use the Microsoft compiler (it is said to generate slightly better code than MingW).

    Best regards,
    Marc

  7. #6
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Installing Qt 4.7 and to Visual Studio 2008

    I use VS2008 for a few reasons:

    Libraries I've already written in VS2008 that I don't want to port to MinGW
    I think VS2008 has a better debugger
    Compiled code is smaller and seems to be better optimised
    Visual Assist for code completion

  8. #7
    Join Date
    Aug 2009
    Location
    Belgium
    Posts
    310
    Thanks
    10
    Thanked 31 Times in 25 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Installing Qt 4.7 and to Visual Studio 2008

    Libraries I've already written in VS2008 that I don't want to port to MinGW
    Compiled code is smaller and seems to be better optimised
    No, no, I didn't suggest you to use MingW, but to use the VS compiler/linker with QtCreator. There are two precompiled packages for Qt on Windows : 1 for MingW and 1 for VS.

    I think VS2008 has a better debugger
    OK, this is the one thing that working 'natively' in the VS environment may be better in.

    Visual Assist for code completion
    Code completion in QtCreator is also very good and supports all Qt specialties (like signal and slot names).

    But hey, I believe everyone should use the environment they prefer, so... peace man

  9. #8
    Join Date
    Oct 2010
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Installing Qt 4.7 and to Visual Studio 2008

    My current preferred is Python and PyQt4

    I feel the need to branch over to C++, so I'm learning Qt and C++ side of things. I didn't know you could program straight into the Creator either. I've run through one of the examples from the help: 'Creating a Qt C++ Application' and when compiling it, it throws this error at me:

    'cl' is not recognized as an internal or external command,
    operable program or batch file.
    command failed with exit code 9009
    'cl' is not recognized as an internal or external command,
    operable program or batch file.
    command failed with exit code 9009
    'cl' is not recognized as an internal or external command,
    operable program or batch file.
    command failed with exit code 9009
    'cl' is not recognized as an internal or external command,
    operable program or batch file.
    command failed with exit code 9009
    jom 0.9.4 - empower your cores
    command failed with exit code 2
    The process "C:/Qt/2010.05/bin/jom.exe" exited with code %2.
    Error while building project TextFinder (target: Desktop)
    When executing build step 'Make'

    It compiles fine from the visual studio when I follow the steps listed above.

  10. #9
    Join Date
    Mar 2009
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Installing Qt 4.7 and to Visual Studio 2008

    Install the VS2008 Binary Package then install the VS2008 Plugin. It should work find unless you did something wrong, but it's hard to do anything wrong when all you do is run the setup program. Installing one after the other, the plugin detected my Qt installation automatically.

    IRT the Visual Studio vs. Qt Creator stuff. There is no comparison between Qt Creator and Visual Studio. Visual Studio does almost everything better. From Editor to Project Manger to a fully integrated Help System (C++ Libraries + Qt stuff).

    Visual Studio generates faster and smaller binaries than MinGW.

    And "slightly" is quite a subjective term. They are factorably so, and Visual Studio will outperform pretty much any other compiler on Windows barring maybe Intel's compiler in some scenarios (and usually on Intel's processors) because Microsoft invests significant resources in the toolchain used to build their OS and software products (including their mobile products, like Windows Phone 7, etc.).

  11. #10
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Installing Qt 4.7 and to Visual Studio 2008

    Quote Originally Posted by marcvanriet View Post
    Code completion in QtCreator is also very good and supports all Qt specialties (like signal and slot names).
    I totally agree. Qt Creator is also free compared to the $249 that Visual Assist costs, plus you need to purchase the Visual Studio environment as the plugin doesn't work with the free editions.

  12. #11
    Join Date
    Oct 2010
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Installing Qt 4.7 and to Visual Studio 2008

    That's the error that the QTCreator throws me when I try to compile in there, when compiling in visual studio, it found everything and the debug compile works. That just worked.

    Though it's kinda annoying to have to go over to visual studio every time to compile the window to see the changes, instead of it running in the Creator, due to that jom.exe error.

  13. #12
    Join Date
    Aug 2009
    Location
    Belgium
    Posts
    310
    Thanks
    10
    Thanked 31 Times in 25 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Installing Qt 4.7 and to Visual Studio 2008

    Hi,

    cl is the linker from visual studio. Strange that it is not found. When I installed the Qt SDK for visual studio, and QtCreator, it automatically recognised that Visual Studio had to be used, and it has no problem finding it. I don't know how he did find it though. Note : it doesn't have to do with any 'path' setting, because Visual Studio is not in my path, and QtCreator finds it anyway.

    In QtCreator you could check under the 'Projects' icon on the left, then 'run settings', then expand the details of the run environment, and then check the 'PATH' variable that is used in the build. Visual Studio should be in it.

    About QtCreator vs Visual Studio - without wanting to start an 'editor' war - it is not true that 'Visual studio generates smaller/faster/... better binaries than QtCreator". Both are a development environment, not compilers or linkers. Both can use the same MSVC compiler/linker, so they can generate identical binaries. If you use QtCreator with MingW instead, you will get differences of course.

    Best regards,
    Marc

  14. #13
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Installing Qt 4.7 and to Visual Studio 2008

    If you want to be picky about it, theres no such thing as a MSVC compiler, as the word 'Visual' is strictly for the IDE and only makes sense there, not the compiler. The banner displayed when running the compiler/linker also says "Microsoft (R) 32-bit C/C++ Optimizing Compiler". It never mentions the word 'Visual'.

    Secondly, Without any modifications, QtCreator uses GCC, Visual Studio uses the Microsoft C/C++ compiler/linker, so I'd say it's fair enough to say that Visual Studio generates smaller/faster/better binaries than Qt Creator. After all, you are never going to use MinGW under Visual Studio.

    Finally, 'cl' is the compiler, not the linker. In the displayed banner, it clearly states this. The incremental linker is called 'link'.

    Sure, if you tell QtCreator to use the Microsft C/C++ compiler, it will generate the exact same code, should you give it the exact same switches.
    Last edited by squidge; 6th October 2010 at 23:28.

  15. #14
    Join Date
    Aug 2009
    Location
    Belgium
    Posts
    310
    Thanks
    10
    Thanked 31 Times in 25 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Installing Qt 4.7 and to Visual Studio 2008

    Agreed about the cl and Visual and so.

    Not that QtCreator cannot use the MS compiler/linker without modifications. If you download and install "Qt libraries 4.7.0 for Windows (VS 2008, 226 MB)" from the Qt website, and download and install QtCreator (or was it already included, I don't remember) then QtCreator automatically recognises that the MS compiler/linker has to be used. No need to rebuild or figure out any settings yourself.

    Regards,
    Marc

Similar Threads

  1. QT4 not working in Visual Studio 2008
    By mnemonic69 in forum Installation and Deployment
    Replies: 4
    Last Post: 27th May 2010, 05:37
  2. Qt 4.6.1 and Visual Studio 2008[SOLVED]
    By ^NyAw^ in forum Installation and Deployment
    Replies: 0
    Last Post: 15th February 2010, 16:19
  3. Visual Studio 2008 and Qt
    By konx in forum Installation and Deployment
    Replies: 2
    Last Post: 22nd January 2010, 21:24
  4. How to use Qt with Visual Studio 2008?
    By N3wb in forum Installation and Deployment
    Replies: 2
    Last Post: 13th August 2009, 16:23
  5. Qt 4.3.2 + Visual studio 2008
    By moowy in forum Installation and Deployment
    Replies: 6
    Last Post: 6th December 2007, 06:41

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.