Using Qt in VS2013

2019-09-01 09:09发布

I have recently discovered Qt 5.2, and it looks pretty nice for me, though I have a problem: I want to use it inside Visual Studio 2013. I downloaded the Visual Studio Add-in 1.2.3 Alpha for Qt5 from the Qt's official website.

I have created a project in my Visual Studio 2013 solution (a Qt Application) and when I try to compile it,

Error   3   error LNK2038: mismatch detected for '_MSC_VER': value '1700' doesn't match value '1800' in moc_graphicalui.obj E:\Applications\SizeWrite\GraphicalUI\qtmaind.lib(qtmain_win.obj)   GraphicalUI

I've already read something, I guess it was a question on Stack Overflow, but I didn't clearly understand what I have to do, to solve this properly. So, can anyone help me?

My OS: Windows 8.1 Pro x64

IDE: Visual Studio 2013 Ultimate x86

2条回答
做个烂人
2楼-- · 2019-09-01 09:38

It looks like this is an issue with your Qt installation rather than the VS Addin. I think you have installed the binaries for VS2012 (_MSC_VER=1700) rather than VS2013 (_MSC_VER=1800). It looks like there aren't yet binaries available for VS2013 from the Qt download page so I would suggesting building them from the sources.

查看更多
不美不萌又怎样
3楼-- · 2019-09-01 09:42

I have similar problems in VS2013, but actually I provoqued that error ( by error :) ), since I would need to compile 32 bit Qt libraries instead of the common libraries for VS2013, but it seems they are only built for the 64 bits architecture. Thus, it seems that we should use 64 bit Qt libraries if we use VS2013, since we have to import a directory called .../Qt/5.3/msvc2013_64 and there is no directory called, for example, .../msvc2013_32 or just .../msvc2013. In fact, I provoqued that error when trying to use the libraries from the VS2012 directory .../Qt/5.3/msvc2012_opengl, which is really an older version than the platform I am using (VS2013).

Thus, if you want to compile Qt libraries on your VS2013, it seems that you must change your platform and debug mode to 64 bits in the settings of your VS2013 project. At least, this works for me.

Hope it solves your problem, and if anyone knows how to compile 32 bit Qt libraries in VS2013 let it know. Thank you.

查看更多
登录 后发表回答