当前位置:网站首页>Visual studio configures QT and implements project packaging through NSIS
Visual studio configures QT and implements project packaging through NSIS
2022-06-30 12:42:00 【DeepHao】
Visual Studio To configure Qt
Click on here Go to Alibaba software source to download Qt, What I use here is Qt5.14.2, Double click Install after download . Need to have Qt Account number , If not, you can take Qt Apply for . Click next in turn , Again Qt When selecting components , The recommendations are shown in the figure below , take MSVC and MinGW All choose , also 32 Bit and 64 All bits are installed

Install and use Visual Studio 2017, Pay attention to check " Use C++ Desktop development "
Visual Studio 2017 To configure Qt5.14.2, choice “ Tools ", Expansion and update , Search for Qt And install 

choice Qt VS Tools, choice Qt Versions,
add to Qt Of MSVC route , find “qmake.exe", Click ok , take 32 Bit and 64 Bits are added , Easy to switch at any time 
NSIS install
Go to Official website , Download and install

Qt Project packaging
windeployqt Implement packaging
utilize visual studio To complete a Qt engineering , As shown below , The tutorial is in bilibili, choice x64 and release
After compilation, the project directory will generate "x64/Release/CoinFlip.exe" file 
Create a new folder on the desktop Coin, Name at will , Put the above .exe Copy files to 
open Qt The command box comes with you ( Do not use windows Self contained cmd)

VCINSTALLDIR
D:\programming\Microsoft Visual Studio\2017\Community\VC
The value is Visual Studio Under the installation path of VC
Use NSIS Further packaging
Pack the whole of the above Coin Folder compressed into “.zip” file , open NSIS Software . Follow the steps shown below , Click on the bottom right corner when finished generate, Just wait for it to finish 
Appears after completion exe file , Double click Install 
Use NSIS Custom script implementation further packaging
clone This warehouse , Enter into VimeoSetup Catalog , Take the next step Coin Folder replacement VimeoSetup Under the App Folder and rename App
open “NSIS-UI-Plugin” engineering 
choice Release or Debug, choice x86,Qt VS Tools Medium version selection x86
stay " attribute " Revision in China "Qt Installation", Click on “ application ”,“ determine ”
After completion , Right click " Generate ", When it's done "Win32\Release" Lower generation "NSIS-UI-Plugin.dll" file 
If an error is reported but an "NSIS-UI-Plugin.dll" file , Don't worry , This is because... Was not added NSIS environment variable , So will NSIS Add to the environment variable to resolve , Where the value is NSIS The installation path
NSIS_DIR
D:\Program Files (x86)\NSIS

Another solution is to generate "NSIS-UI-Plugin.dll" Manually copy files to "D:\Program Files (x86)\NSIS\Plugins\x86-unicode", And rename to "nsQtPlugin.dll", If previously used Debug The schema is renamed "nsQtPluginD.dll"
However, it is recommended to add environment variables , Because the following steps still need to add NSIS environment variable
Get into "VimeoSetup", edit "vimeo-template.nsi" file , The meanings of each variable are as follows 
I'll change it as follows , I created a new icon , So I changed the pop-up icon to the corresponding file name 
Save when done , add to NSIS environment variable ( As shown above ). double-click "build-setup.bat", If it is Debug Mode double click "build-setup [debug].bat", Can open "bat" File to see the running command
@echo off
python.exe ..\NsisScriptGenerate.py "%~dp0vimeo-template.nsi" "%~dp0App"
"%NSIS_DIR%\makensisw.exe" "%~dp0\vimeo.nsi"
PAUSE
You may encounter the following problems , Because of the original NsisScriptGenerate.py use Python2, Therefore, the following modifications are required
print "file total: " + str(g_extract_file_cmd_total) + ", dir total: " + str(g_create_dir_cmd_total)
in
print("file total: " + str(g_extract_file_cmd_total) + ", dir total: " + str(g_create_dir_cmd_total))
print nsis_script_template_path
in
print(nsis_script_template_path)
print g_root_dir
in
print(g_root_dir)
Double click when finished "build-setup.bat", if Debug Pattern , double-click "build-setup [debug].bat"
If there is no response , Need to add Python environment variable ( because ".bat" The file will call the system cmd, Therefore, the system environment variables will be retrieved Python, See Python Environment variable add ), Or manual use Python Execute... In the current directory
python ../NsisScriptGenerate.py vimeo-template.nsi App
To generate "vimeo.nsi" file , And then double-click "build-setup.bat", if Debug Pattern , double-click "build-setup [debug].bat"
When finished, get "CoinFlip-setup.exe" file 
Double-click to open , You will get the following installation process



Python Environment variable add
Add the following environment variables :
take Python Add the installation directory to the environment variables and Scripts Folder path

If input Python Always open the Microsoft app store , The solution is as follows :
Search in settings " Application execution alias ", Disable the response shortcut , When it's done "cmd" Input in "python", When the following interface appears, the addition succeeds


边栏推荐
猜你喜欢

Pinda general permission system (day 7~day 8)

Joplin implements style changes

Redis-缓存问题

Tencent two sides: @bean and @component are used on the same class. What happens?
![[cloud native | kubernetes] in depth understanding of deployment (VIII)](/img/88/4eddb8e6535a12541867b027b109a1.png)
[cloud native | kubernetes] in depth understanding of deployment (VIII)

SuperMap 3D SDKs_Unity插件开发——连接数据服务进行SQL查询

How to detect 3D line spectral confocal sensors in semiconductors

【一天学awk】基础中的基础

Lichuang EDA learning notes 10 common connector component identification and passive buzzer driving circuit

MySQL built-in functions
随机推荐
MySQL中变量的定义和变量的赋值使用
JMeter之事务控制器
Hisilicon 3559 universal platform construction: introduction to YUV format
What is the principle of spectral confocal displacement sensor? Which fields can be applied?
【一天学awk】数组的使用
"Xiaodeng" user personal data management in operation and maintenance
Pharmacy management system
Analysis of the whole process of common tilt data processing in SuperMap idesktop
JMeter之性能测试流程及性能测试关注点
How difficult is data governance and data innovation?
Joplin implements style changes
SuperMap 3D SDKs_ Unity plug-in development - connect data services for SQL queries
问卷星问卷抓包分析
Why should offline stores do new retail?
How to use the plug-in mechanism to gracefully encapsulate your request hook
Docker安装Mysql8和sqlyong连接报错2058的解决方法[随笔记录]
dataworks 同步maxcomputer 到sqlserver ,汉字变乱码了,请问怎么解决
Generate entity classes from SQL Server database tables through EF core framework
【300+精选大厂面试题持续分享】大数据运维尖刀面试题专栏(二)
Reading the table data of Tencent documents in the applet