How to use Qt MSVC 2012/13



  • Hi all,

    I'm assigned to check out some Windows software which appears to be created with Visual Studio 2012. I want to use Qt Creator to debug the software and it seems I have to use Visual C++ compiler as the software seems to use some libraries that are not found when compiling with MinGW. For instance, "stdtext" library seems undefined.

    Anyways, I want to use Qt and MSVC2012/13. How can I add MSVC2012 as compiler in Qt creator? What (please be specific) do I have to install to make the MSVC2012 compiler appear in the list of compilers in Qt Creator? Do I need to install Visual Studio? Or is it possible to download just the compilers from somewhere (it should, imo).

    Cheers
    Birger from Norway



  • Hi,
    There are multiple topics already for this, but here goes again:

    • Install MSVC201x version (which one you need)
    • Get the Qt with the same compiler build
      Start up Qt and it should find your MSVS compiler automatic!

  • Moderators

    Hi, welcome to devnet

    @birger.sp said:

    it should, imo

    Well tell that to the MS guys :)

    Up to some version a standalone compiler was available as part of Windows SDK, but now it is no longer the case so you do need to install Visual Studio. A free Express (for VS2012) or Community (VS2013) edition will suffice. Also when installing it choose non-standard installation and deselect anything you don't need.

    Since you also want to debug the app you will need to setup a debugger. Unfortunately the one from VS installation can't be used so you'll need to download Windows SDK and during installation select "Debugging tools for Windows".

    After that you need to install Qt Creator and a Qt package for your compiler. The easiest way is to use the online installer that will let you select these components.

    Be mindful that you can't mix and match QT/VS compiler versions. If you install VS2012 you need to use Qt package that was meant for it. Using a package for another version will break your app.



  • Hi,
    That is the total story yes!
    Btw I never encountered problems when using different MS compilers, but it's does not guarantee proper linking if you do not.
    Greetz!


  • Moderators

    Btw I never encountered problems when using different MS compilers

    Then you're a very lucky man ;) Issues caused by mixing VS versions were the culprit of the worst debugging marathons I had.

    There are changes not only between versions but even between service packs (or Updates as they are called now).
    Just for a small example go to this blog post and scroll down to the bottom where a table lists size changes of STL containers between various updates.
    Good luck debugging an app that mixes these. STL related are the easier of problems you'd possibly encounter. There are far worse.

    Save yourself some hair and don't do it. Ever ;)



  • Hey guys, thanks for your replies :)

    @Jeroentjehome said:

    There are multiple topics already for this, but here goes again:

    Sorry 'bout that. This information should probably be specified when downloading/installing Qt... Hopefully they will do something about it.

    @Jeroentjehome said:

    • Install MSVC201x version (which one you need)

    (sigh)
    See, this is kinda the problem I'm having when trying to figure this out... What (exactly, with 100% accuracy) is it I need to install? Googling "msvc2012 download" redirects me to "Download Visual C++ Redistributable for Visual Studio ..." but downloading and installing that does not fix it. Neither does downloading "Visual C++ Compiler" of any version.

    @Chris-Kawa said:

    Hi, welcome to devnet

    Thanks!

    @Chris-Kawa said:

    ... so you do need to install Visual Studio. A free Express (for VS2012) or Community (VS2013) edition will suffice. Also when installing it choose non-standard installation and deselect anything you don't need.

    Aha! This is crucial information. For new developers, this is far from obvious. Installed Visual Studio 2013 and now its working, thanks :)

    I won't mix, this is hard enough as it is (thats what she said)

    Cheers


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.