简体   繁体   English

如何使用Visual Studio 2017与Qt开发GUI应用程序?

[英]How to use Visual Studio 2017 with Qt to develop GUI applications?

I have searched everywhere but I can't seem to find support for the latest Visual Studio version. 我到处搜索但似乎无法找到对最新Visual Studio版本的支持。

Is there some way of getting round this? 有没有办法解决这个问题?

Qt 5.9.1 and later versions are pre-built for VS 2017 64 bits. Qt 5.9.1及更高版本是针对VS 2017 64位预先构建的。 You can download it from official Qt webpage . 您可以从官方Qt网页下载。 If you need 32 bits I'm sorry to tell you that you will need to compile it manually (good luck, it is usually not a straightforward nor simple process). 如果你需要32位,我很遗憾地告诉你,你需要手动编译它(祝你好运,这通常不是一个简单直接的过程)。 See updates below . 请参阅以下更新

In addition, you will need the VS Tools. 此外,您还需要VS Tools。 You can download latest version for VS 2017 from here (official downloads page hasn't been updated yet about this). 你可以从这里下载VS 2017的最新版本(官方下载页面尚未更新)。 There is no stable version for VS 2017 ( see update below ), but the latest (although a bit old) development build fixes major integration problems. VS 2017没有稳定的版本( 请参阅下面的更新 ),但最新的(虽然有点旧)开发版本修复了主要的集成问题。 You can downloaded from here . 你可以从这里下载。

Finally, just take a look at the official documentation for a quick tutorial about how to use it. 最后,只需查看官方文档 ,即可获得有关如何使用它的快速教程。 Basically: 基本上:

  • Configure your Qt version with the VS Tools: in VS go to Qt VS Tools > Qt Options and add your installation. 使用VS Tools配置Qt版本:在VS中,转到Qt VS Tools> Qt选项并添加安装。
  • You can now create a new project. 您现在可以创建一个新项目。 The extension will add a new templates collection under Visual C++ called Qt , there you will probably use the Qt GUI Application . 该扩展将在Visual C ++下添加一个名为Qt的新模板集合,您可能会使用Qt GUI应用程序
  • The rest is standard Qt programming. 其余的是标准的Qt编程。 The VS Tools take charge of all the compilation of .ui files (interface design), moc'ing needed files, translations (if used), etc. VS Tools负责.ui文件的所有编译(界面设计),moc所需文件,翻译(如果使用)等。

UPDATE: as mentioned in this post from MSDN , binaries generated usign VS 2015 are compatible with VS 2017. So in this case, the Qt compilations for 2015 (32 and 64 bits) should also work. 更新:正如MSDN上的这篇文章中所提到的,生成的二进制文件VS 2015与VS 2017兼容。因此,在这种情况下,2015年的Qt编译(32位和64位)也应该有效。

UPDATE (2018-9-13): since two months ago we've been using the 32-bits build from VS 2015 in VS 2017 (including the latest 15.8.4 update). 更新(2018-9-13):自两个月前我们在VS 2017中使用VS 2015的32位版本(包括最新的15.8.4更新)。 No issues found so far in this sense. 到目前为止,在这个意义上没有发现问题

UPDATE (2018-12-10): Qt 5.12.0 (LTS) comes with precompiled binaries for VS 2017 32 and 64 bits. 更新(2018-12-10): Qt 5.12.0(LTS)带有VS 2017 32和64位的预编译二进制文件。


UPDATE: last February was launched the first official release of the VS Tools for VS 2017. You can read more on it in the Qt's blog . 更新:去年2月推出了VS Tools for VS 2017的第一个正式版本。您可以在Qt的博客中阅读更多内容。

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

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