简体   繁体   English

Qt 5.12.1 with Visual Studio2017,从命令行构建

[英]Qt 5.12.1 with Visual Studio2017, build from command line

I linked Qt5.12.1 with Visual Studio 2017.我将 Qt5.12.1 与 Visual Studio 2017 联系起来。

I want to use Qt's cmd.exe terminal to qmake an application.我想使用 Qt 的 cmd.exe 终端来创建一个应用程序。 But, each time I open the Qt's cmd.exe terminal, it tells that但是,每次我打开 Qt 的 cmd.exe 终端时,它都会告诉我

Setting up environment for Qt usage...
Remember to call vcvarsall.bat to complete environment setup!

So I must to run vcvarsall.bat, and only then I can qmake.所以我必须运行vcvarsall.bat,然后我才能qmake。 But I think that is too troublesome.但是我觉得那太麻烦了。 Are there any ideas to solve that problem, so that I wouldn't need to manually run vcvarsall.bat every time I open the cmd.exe terminal.有没有解决这个问题的想法,这样我就不需要在每次打开 cmd.exe 终端时手动运行 vcvarsall.bat。

See existing Qt bug reports about the same issue you have discovered like 1 and 2 .请参阅有关您发现的相同问题的现有 Qt 错误报告,例如12 Unfortunately, you can't avoid it in Qt 5 until the issue is fixed (if ever).不幸的是,在问题得到解决之前,您无法在 Qt 5 中避免它(如果有的话)。

But I think you could check properties of the Qt command prompt entry (press right mouse button on top of the entry which you clicked to open the command prompt) in Start menu to see which bat file it's calling and edit that script.但我认为您可以在开始菜单中检查 Qt 命令提示符条目的properties (在您单击的条目顶部按鼠标右键以打开命令提示符)以查看它正在调用哪个 bat 文件并编辑该脚本。

I think you could add something like below to the end of the bat file to get vcvarsall called automatically.我认为您可以在 bat 文件的末尾添加类似下面的内容,以自动调用 vcvarsall。 Check where vccarsall.bat is located in your VS version and depending on your environment use either x86 or amd64 .检查 vccarsall.bat 在您的 VS 版本中的位置,并根据您的环境使用x86amd64 Note that the following line is only to get you an idea how to call another bat file from a bat file, this line sets VS2015 64bit env.请注意,以下行只是为了让您了解如何从 bat 文件调用另一个 bat 文件,这一行设置了 VS2015 64bit env。

CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64

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

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