How to use Qt5 and Qt Creator 2.6.1 with compiler

2019-04-04 08:47发布

问题:

The official downloads only include Qt libraries 5.0.0 for VS 2010 now. I tried them in VS 2012 Express but got an error message as "error: LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700'..."

Do I have to install VS 2010 or compile the entire source code of Qt5 in VS 2012?

UPDATE: My IDE is Qt Creator 2.6.1. I only use the C++ compiler in VS 2012 because there are no Qt libraries 5.0.0 for minGW in the official downloads yet.

UPDATE-2(2013-1-1): Saw it today, the official blog says:

There are a few things we’re still working on for the 5.0 series. We have bugs that we want to fix. We currently do not have binary packages for MinGW (as WebKit doesn’t yet work with it yet) and MSVC 2012 (you’ll need to compile from source), and we’ll work on delivering these as soon as possible. The current plan is to have a first patch level release, 5.0.1, some time before the end of January.

UPDATE-3(2013-1-31): That comes finally, but only adds Qt 5.0.1 for MinGW 4.7.

UPDATE-4(2013-7-06): After a long wait, Qt 5.1.0 for Windows 32-bit (VS 2012, 511 MB) added.

回答1:

You are right - if you want to use MS VC 2012 compiler, you have to compile QT5 libraries manually. The tutorial can be found on http://qt-project.org/wiki/Building_Qt_5_from_Git. Another option is to install VS 2010 and use it until Digia will make pre-compiled VC 2012 and MinGW libraries. If you use QT Creator as your primary IDE, it should be enough to install VC 2010 Express only.



回答2:

What do you have set in Visual Studio 2012?

Project properties > General > Platform toolset

Try setting it to v110.

More info at MSDN.