简体   繁体   中英

Qt 5.12.1 with Visual Studio2017, build from command line

I linked Qt5.12.1 with Visual Studio 2017.

I want to use Qt's cmd.exe terminal to qmake an application. But, each time I open the Qt's cmd.exe terminal, it tells that

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. 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.

See existing Qt bug reports about the same issue you have discovered like 1 and 2 . Unfortunately, you can't avoid it in Qt 5 until the issue is fixed (if ever).

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.

I think you could add something like below to the end of the bat file to get vcvarsall called automatically. Check where vccarsall.bat is located in your VS version and depending on your environment use either x86 or amd64 . 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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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