Please nominate your Qt Champions for 2021!

Qt in Visual Studio 2012

  • HI !
    I tried installing QT in Visual Studio 2012 without any sucess.
    I downloaded the source code (zip file) for Qt 4.8 and unzipped it in the folder C:\Qt\4.8.
    i opened the command window VS2012 x64 Native Tools then typed
    cd C:\Qt\4.8
    set CL=/MP
    configure -developer-build -opensource -opengl desktop

    I have got all the gossip from configure command syntax and nothing more.
    The system is not asking for license and so on ...

    Do you have any idea ? I use Visual Studio Premium.

    Many thanks

    edit: please don't shout, also not in titles; Andre

  • You need a newer version of Qt that supports this very recent compiler. Qt 4.8 was released far before VS2012 was.
    I think 5.0.1 supports VS2012.

    Also please consider using QtCreator, its quite a bit better than Visual Studio IMOHO.

  • Thanks for reply. I tried with QT 5 and I didn't succeed in launching configure

  • Building Qt5 is different, search on this site and the wiki for more details.

  • Trying to launch configure but again without any sucess with VS 2012. We are in 2013 not 2010 ! Where can I find Qt source 5.0.0 ?
    Seems to be OK following a youtube tuto.

    Very disappointed. It takes more time to make QT VS 2012 compliant than to write a few hundreds lines to get the UI I want.

    Thanks to QT staff to help the sooner the better

  • Moderators

    What problems are you experiencing? I can vouch that MSVC 2012 32-bit can compile Qt 5 on Windows 8 64-bit without much trouble.

    See also , which says "To properly configure and build Qt 5 from source you also need Perl (>=5.14) and Python (>=2.6.x), as well as a working compiler."

  • I installed Active Perl 64 bits and Python (x86 and x64), launched nmake and about one hour later I got 5 fatal errors that are U1077 'cd' : return code 0x2.

    I guess that I am facing big trouble. Am I not ?

  • At the end I can read :

    'python' is not recognized as an internal or external command.
    Then first error U1077 'python' return code 0x01
    Then second error about nmake.exe return code 0x02
    Then third, fourth and fifth errors return code 0x02

  • Moderators

    You need to add perl and python to your PATH. Either by setting it globally in the system settings or for this session in the command line before you run nmake:
    set PATH=%PATH%;C:\PathToPerl;C:\PathToPython
    The good news is you don't need to restrat from scratch. If you get that error fix your PATH and type nmake again, it will pick up where it sopped.

  • Moderators

    Hmm.. the ActivePerl and ActivePython installers should have updated the system PATH automatically. Try restarting your computer first; Windows won't see the updated PATH otherwise

  • Moderators

    [quote author="JKSH" date="1361142534"]Try restarting your computer first; Windows won't see the updated PATH otherwise[/quote]
    That's actually no longer true starting from (I think)Vista. Win7/8 for sure. Just re-open a console and you're good to go.
    I might be wrong, but from what I recall installers ask you if you want them to update your PATH and at least for one of them it was not the default.
    Personally, if I can, I try not to pollute the global PATH and just include what I need on a per console session basis. All sort of crazy errors occur when there are conflicting things there (eg. git on windows is a very naughty piece of software).

  • Guys and girls I would like to thank you because it runs !

    On Windows 7 :

    I downloaded Perl and Python 32 bits then the Qt source version 5.0
    I created a folder C:\Qt\5.0.1 and put the zip file on it.
    Unzipped it.

    Before starting the configuration you have to set your environmental variables to tell the system where you put Perl and Python. So :
    Start > Right Click on Computer icon > Properties > Advanced System Settings > Advanced > Environment Variables > System Variables.
    Select the variable "Path" and select "Edit". Do not delete what is written in this variable and add ";" (if not present) C:\Path to Perl.exe add another ";" C:\Path to Python.exe
    Save and quit the dialog box.

    Then Start > Microsoft Visual Studio 2012 > Visual Studio Tools > Open VS2012 x64 Native Tools Command Prompt
    First of all you have to change your folder with the command :
    cd C:\Qt\5.0.1\qt-everywhere-opensource-src-5.0.1
    Then type :
    SET CL=/MP
    Then type :
    configure -developer-build -opensource -opengl desktop (-nomake tests -nomake examples)
    The ones in brackets are optional - do not type in the brackets.
    You should accept the license by entering "y".
    After a while (2-3 minutes) type in:
    It takes a very long time : about 3 hours (i7 - 2670QM@2,2 GHz).

    Then browse to Qt Project Website > Other Downloads and download Visual Studio Add-in 1.2.0 for Qt5 and run it.

    Launch Visual Studio 2012. You should see Qt5 on the main bar. Select it and go to "Qt Options" > Add and enter a name for the version name and enter the path where you have qmake.exe (you should find it in the folder "bin". Save your selection.

    You're now ready starting using Qt in VS 2012 !

    That's All Folks !

  • Now tre trouble comes when I want to compile a Qt Project.
    I've got a linkage error LNK 1112.
    This is a conflict between 32 and 64 bits.

    How can I manage it ?


  • I solved the issue by using VS 2012 x86 Native Tools Command Prompt instead.

  • Consider adding [SOLVED] in the post title

  • I checked this today, works fine for Windows 7 x64 Ultimate with VS 2012 x64 Ultimate. There is a small mistake in last point "After a while (2-3 minutes) type in: qmake" command prompt returned "no such command" and I had to use "nmake". Another tip :D form "" after finishing build of all files run @nmake clean
    cd qttranslations

  • I'd like to suggest that these notes be formalized and displayed prominently in an article linked on the home page. I am a newcomer to Qt, but I am an experienced C++ programmer and I use VS 2012.

    It seems to me that integration instructions for Microsoft's current development environment, as of April 2013, might rightfully be considered of paramount importance in terms of a "getting started on Windows" guide.

    That way, a user who wishes to integrate Qt with Microsoft's most current IDE will not have to dig through forum postings, as I have had to do.


  • Hey guys. I've been working on a community wiki on stackoverflow for this exact problem. It's certainly not perfect and I think needs some work from people who know more than I, but it's a start:

  • I have carefully followed the steps to build Qt on Windows 7 64-bit (but building Qt in 32-bit mode) in the linked StackOverflow Community Wiki (see previous comment for link), but I cannot overcome the following error while running nmake:

    "c1xx : fatal error C1083: Cannot open source file: '.rcc\debug_shared\qrc_mimetypes.cpp': No such file or directory."

    (And, indeed, there is no "qrc_mimetypes.cpp" file anywhere in my Qt folder or its subfolders.)

    I have posted a new StackOverflow question here:

    Any help would be appreciated. It seems that building Qt on Windows is not straightforward, even when following all directions with meticulous care. Thanks!

  • I have resolved the problem to be a catastrophic bug with the Avast! antivirus sandbox. Only a complete uninstallation of Avast! suffices; as long as Avast! remains installed on the system, it is impossible under any circumstances to build Qt.


  • Moderators

    If it's a bug with Avast's sandboxing engine, then it needs to be fixed as it will probably frustrate many other users in the meantime. Please notify the Avast developers.

  • I have already alerted Avast. I sent them a detailed email this morning. Frankly, I suspect that their company (with 200,000,000 users) is now too top-heavy to care.

    I will report here if and when they respond.

  • Moderators

    Great, thanks for your efforts :) Fingers crossed that they remember how they grew popular in the first place

  • Another VS2012 build issue, involving ICU support.

    When ICU is enabled ("-icu" on the configure command line, along with a proper build of ICU in VS2012 and proper inclusion of all ICU paths (header, .lib, and .dll)), Line 688 of "qtbase\src\corelib\codecs\qtextcodec.cpp" returns a NULL codec (ICU fails to return a codec) when asked for a codec whose name is "US-ASCII".

    Later, this NULL codec variable is dereferenced by the "lrelease.exe" utility when it attempts to perform a translation during the Qt build, which crashes lrelease.exe and causes the Qt build to stop with an error.

    It therefore seems to be impossible to include ICU support with a VS2012-compiler 32-bit build of Qt5.

    Might someone possibly be able to confirm and/or look into this?

  • Note the further, related issue that this means that Webkit cannot be built for VS2012, either, since Webkit requires an ICU build of Qt.

Log in to reply