Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How install 64-bit Qt on Windows with C++11 support?

IN A NUTSHELL:

  1. My 64-bit Qt build doesn't have C++11 support.
  2. My Qt build with C++11 is 32-bit.
  3. Qt5 using the online installer is 32-bit
  4. Despite having dedicated the last 3 days of my life to this, I can't get 64-bit Qt5 to build from source.

Help! Something must be incompatible in my environment, but what could it be?


So, I need to develop 64-bit Qt apps with C++11 on Windows. I've found threads/guides here, here, here, here and here, and none of them work or apply, though I note the second of these let me build Qt 4.8.3 with C++11 support (but 32-bit). The third one looks more complicated than it should be and also involves building with VS 2010, which seems like part of the problem, so I haven't tried it. I have also wasted a lot of time trying to build previous versions with different compilers, like mingw and clang, so I'm pretty sure that cl is what I need to use.

Basically, I've gotten to the point where I can build Qt4.8.3 and execute 64-bit apps from within QtCreator 2.6.1, but I can't get full C++11 support. It finds only cl from VS 10.0 which has only very limited C++11 support. Figuring out how to get it to use cl from VS 11.0 would be one solution to my problem. But when I try

QMAKE_CXX = C:/Program Files (x86)/Microsoft Visual Studio 11.0/VC/bin/cl

the build fails with a jom Error 2, and if I select the option for building with nmake I get a similar error.

Qt 5 should have full C++11 support. But when I try to build it myself from source, it fails. The reason for this seems to be that despite running configure/make from the VS2012 x64 Cross Tools command prompt, specifying -platform win32-2012 in the configure step, and specifying QMAKE_COMPILER_DEFINES += _MSC_VER=1700 WIN32 as per
this guide, in both the win32-msvc2010 and win32-msvc2012 mkspecs, it still builds with the cl from VS 2010 and that is causing some kind of conflict. Here is my configure command:

configure -static -debug-and-release -confirm-license -opensource -nomake tests -nomake exampmles -opengl desktop -no-libjpeg -platform win32-msvc2012

And here's the linker failure when I try to build:

Here is the output from my build failure:

At the end of the top 2 paragraphs you can see that msvc-2010 is being included, and earlier in the console output (not shown) there is -D_MSC_VER=1600 in the moc commands.

So I'm at a loss, can anyone help?

Edit: I had stated that I was building 64-bit apps with Qt5, actually I'm able to build 64-bit apps (w/o C++11 support) off a build of Qt 4.8.3. If I try this with Qt5, I get this error:

LNK1112: module machine type 'X86' conflicts with target machine type 'x64'

So this leads back to compiling Qt5 in 64-bit mode, which I can't seem to do.

like image 347
Matt Phillips Avatar asked Jan 20 '13 00:01

Matt Phillips


2 Answers

Finally got a 'good enough' solution by going back and rebuilding 4.8.3 in 64-bit mode, this time ensuring that it was built with C++11 support. Since a solution involving Qt5 is what would be ideal, I'll leave this open for awhile to see if anyone can figure out how to do that.

Importantly, I note that I successfully built 64-bit, C++11-supporting 4.8.3 from the same prompt I had been using to try to build 5.0. Just changed directories. So same environment, everything. And I also have downloaded all the extra prereqs required for Qt5.

like image 64
Matt Phillips Avatar answered Oct 06 '22 10:10

Matt Phillips


You can find prebuilds of Qt 5.0.1 SDK with 64bit support here: http://releases.qt-project.org/digia/5.0.1/latest/

Tested and working :)

like image 42
Robin Lobel Avatar answered Oct 06 '22 11:10

Robin Lobel