简体   繁体   English

在VS2013中使用Qt

[英]Using Qt in VS2013

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. 我最近发现了Qt 5.2,它对我来说看起来很不错,虽然我有一个问题:我想在Visual Studio 2013中使用它。我从Qt的官方网站下载了用于Qt5Visual Studio加载项1.2.3 Alpha

I have created a project in my Visual Studio 2013 solution (a Qt Application ) and when I try to compile it, 我在Visual Studio 2013解决方案( Qt Application )中创建了一个项目,当我尝试编译它时,

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. 我已经读过一些东西,我想这是关于Stack Overflow的一个问题,但是我并不清楚我要做什么,要妥善解决这个问题。 So, can anyone help me? 那么,任何人都可以帮助我吗?

My OS : Windows 8.1 Pro x64 我的操作系统 :Windows 8.1 Pro x64

IDE : Visual Studio 2013 Ultimate x86 IDE :Visual Studio 2013 Ultimate x86

It looks like this is an issue with your Qt installation rather than the VS Addin. 看起来这是你的Qt安装而不是VS Addin的问题。 I think you have installed the binaries for VS2012 ( _MSC_VER=1700 ) rather than VS2013 ( _MSC_VER=1800 ). 我认为你已经安装了VS2012的二进制文件( _MSC_VER=1700 )而不是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 . 看起来Qt下载页面上还没有可用于VS2013的二进制文件,因此我建议从源代码构建它们

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. 我在VS2013中有类似的问题,但实际上我提出了错误(错误:)),因为我需要编译32位Qt库而不是VS2013的公共库,但似乎它们只是为64位架构而构建。 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. 因此,如果我们使用VS2013,似乎我们应该使用64位Qt库,因为我们必须导入名为... / Qt / 5.3 / msvc2013_64的目录,并且没有名为的目录,例如,... / msvc2013_32或只是... / 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). 实际上,当我尝试使用VS2012目录中的库时,我发现了这个错误...... / Qt / 5.3 / msvc2012_opengl,这实际上是比我正在使用的平台(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. 因此,如果要在VS2013上编译Qt库,似乎必须在VS2013项目的设置中将平台和调试模式更改为64位 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. 希望它能解决你的问题,如果有人知道如何在VS2013中编译32位Qt库,就让它知道。 Thank you. 谢谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM