Yellow
Yellow

Reputation: 3957

Linking error because of different versions MSVC and Qt libraries

I am having trouble with compiling a Qt project using the MSVC 2012 compiler. I downloaded Qt first, then realised I didn't have a proper compiler yet, and then downloaded Microsoft Visual Studio Express 2012 and its msvc compilers. However, whenever I try to compile something in Qt Creator, it gives the following error:

qtmain.lib(qtmain_win.obj):-1: LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match with value '1700' in glwidget.obj

So my understanding of what this means is that my Qt libraries are of a different (older) version than my msvc compiler. But I am not sure how to fix it, or how to get other/newer libraries. Some googling told me that the following code added to the Qt .pro file should solve things:

QMAKE_COMPILER_DEFINES  += _MSC_VER=1700 WIN32

But that didn't have any effect. Also, using '1600' instead of '1700' didn't help. Any ideas on what will?

I am working on a 32-bit Windows 7 system, if that's any help, and I'm using Qt 5.0.0.

Upvotes: 3

Views: 4692

Answers (2)

Nemanja Boric
Nemanja Boric

Reputation: 22157

You need binaries compiled for the Visual Studio 2012. Since there is no official (or unofficial) precompiled binaries available, you need to compile them by yourself.

This should not be complicated process, but it can be hard and frustrating for beginners to do to it, so I would suggest you to follow already given advice and to download VS2010 (afterall, it will take less time to download and install it than to compile Qt from source).

Upvotes: 3

york.beta
york.beta

Reputation: 1827

You have to use MSVC 2010, because the libraries are built using it. Try Visual C++ 2010 Express.

Upvotes: 1

Related Questions