8

Windows 8 x86; Qt 4.8.2; Visual Studio Ultimate 2012 RC

Oli4
  • 489
  • 1
  • 9
  • 22
das_j
  • 4,444
  • 5
  • 31
  • 47
  • huh? Visual Studio doesn't use mingw to begin with. – Ben Voigt Jun 02 '12 at 15:25
  • Are you using Qt Creator? Plain qmake? Something else? – Mat Jun 02 '12 at 16:10
  • http://www.qtcentre.org/wiki/index.php?title=Qt4_with_Visual_Studio might be helpful. – phyatt Jun 03 '12 at 06:27
  • I wonder if this question has been made obsolete by events? Pulling the latest QT 4.8.x from git and it seems to process configure -platform win32-msvc2012 just fine when called from the VS 2012 x86 native tools command prompt. Version: "Microsoft Visual Studio Professional 2012 Version 11.0.51020.03 Update 1 CTP" – JonnyRo Jun 25 '13 at 16:59

1 Answers1

12

As far as I know Qt does not yet support Visual Studio 2012 RC. However, I managed to build Qt 4.8 with Visual Studio 2011 beta (the predecessor to Visual Studio 2012 RC - they just decided to rename it) myself. It required making some changes to Qt source code before compiling. Here are the steps I used:

  • Copy mkspecs/win32-msvc2010 to mkspecs/win32-msvc2012 and edit the qmake.conf file to specify _MSC_VER=1700.
  • Search for “msvc2010” in all files in the extracted directory and patch the ~10 places to also understand “msvc2012”
  • In a Visual Studio command shell, cd to tools/configure, run a previous version of qmake (which you need to already have), and then run nmake to update your configure.exe.
  • Search for “make_pair<” in all files and remove the template arguments.
    • This may not be required in VS 2012; in VS 2011-beta I got compile errors with make_pair when template arguments were specified.
  • In src\3rdparty\javascriptcore\JavaScriptCore\runtime\Structure.{h,cpp} change the make_pair calls to explicit JSC::StructureTransitionTableHash::Key constructor calls.
  • Edit src\3rdparty\clucene\src\CLucene\config\define_std.h to comment out _CL_HAVE_HASH_MAP and _CL_HAVE_HASH_SET
  • In a Visual Studio command shell, run the configure program that is installed with the source, e.g.: configure.exe -debug-and-release -platform win32-msvc2012 -opensource
    • [Optionally] add '-nomake demos -nomake examples' to the command line to save build time, and/or '-mp' to build in parallel
  • When the configure is complete, type nmake to start the build. This will build debug and release versions of all the libraries as well as release versions of all the tools (designer, etc.).

It took a little work but it worked for me and I now have dozens of Qt applications up and running, so I figured I'd share with anyone else who wants to build Qt 4.8.x on Visual Studio 11 (Visual Studio 2011 beta or Visual Studio 2012 RC.)

If this seems too complicated, just wait a bit; I'm sure Qt will support Visual Studio 2012 soon.

Conrad Poelman
  • 822
  • 9
  • 11
  • 1
    Follow this link if you see some build problems regarding "pair": http://qt-project.org/forums/viewthread/17771 – echo Oct 10 '12 at 00:23