当前位置:网站首页>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


边栏推荐
- What are the applications of 3D visual inspection in production flow
- pyqt5界面的布局与资源文件的载入
- Basic interview questions for Software Test Engineers (required for fresh students and test dishes) the most basic interview questions
- Wechat launched the picture big bang function; Apple's self-developed 5g chip may have failed; Microsoft solves the bug that causes edge to stop responding | geek headlines
- What is the principle of spectral confocal displacement sensor? Which fields can be applied?
- Double dqn notes
- Global capital market 101: Breit, one of the best investment targets for domestic high net worth people
- Ensemble de cartes
- 如何利用AI技术优化独立站客服系统?听听专家怎么说!
- Lichuang EDA learning notes 10 common connector component identification and passive buzzer driving circuit
猜你喜欢
随机推荐
Flink sql控制台,不识别group_concat函数吗?
Pharmacy management system
Hisilicon 3559 developing common sense reserves: a complete explanation of related terms
Linux系统Redis的安装
Q-learning notes
Global capital market 101: Breit, one of the best investment targets for domestic high net worth people
JMeter性能测试工作中遇到的问题及剖析,你遇到了几个?
[leetcode] 15. Sum of three numbers
How to use the plug-in mechanism to gracefully encapsulate your request hook
pyqt5界面的布局与资源文件的载入
JMeter之性能测试流程及性能测试关注点
1175. prime number arrangement: application of multiplication principle
Shell编程概述
21. Notes on WPF binding
Redis configuration files and new data types
grep匹配查找
Reading the table data of Tencent documents in the applet
Splitting e-commerce systems into micro services
iServer发布ES服务查询设置最大返回数量
FlinkSQL自定义UDTF使用的四种方式







