作者:daodaoliang时间:2016年7月11日16:12:09版本:V 0.0.4邮箱:[email protected]
0. Environmental statement
- System environment: WIN10 64-bit
- Qt Environment: Qt-lib 5.6.0
- QCREAT0R 3.6.1
1. Use the. rc file 1.1 to create under the project
.rc
File
For example version.rc
:
# if defined(UNDER_CE)# include <winbase.h># else# include <windows.h># endifVS_VERSION_INFO VERSIONINFOFILEVERSION 1,0,2,0PRODUCTVERSION 1,0,2,0FILEFLAGSMASK 0x3fL#ifdef _DEBUGFILEFLAGS VS_FF_DEBUG#elseFILEFLAGS 0x0L#endifFILEOS VOS__WINDOWS32FILETYPE VFT_DLLFILESUBTYPE 0x0LBEGINBLOCK "StringFileInfo"BEGINBLOCK "040904b0"BEGINVALUE "CompanyName", "NS\0"VALUE "FileDescription", "数据库测试类库\0"VALUE "FileVersion", "1.0.1.0\0"VALUE "LegalCopyright", "@2016\0"VALUE "OriginalFilename", "NDBPool1.dll\0"VALUE "ProductName", "NDBPool\0"VALUE "ProductVersion", "1.0.1.0\0"ENDENDBLOCK "VarFileInfo"BEGINVALUE "Translation", 0x0409, 1200ENDEND/* End of Version info */
1.2 Modifications
pro
File
Add in Project fileRC_FILE += ./version.rc
2. Using built-in variables
VERSION = 1.2.3 QMAKE_TARGET_PRODUCT = 产品名称 QMAKE_TARGET_COMPANY = 公司 QMAKE_TARGET_DESCRIPTION = 文件描述 QMAKE_TARGET_COPYRIGHT = 版权
3. Anti-crater Tips
Be sure to ensure that the RC file is GBK format, otherwise it will be garbled, the generated RC file is UTF-8 format by default
http://daodaoliang.com/blog/2016/07/11/Qt%E7%BB%99%E5%BA%94%E7%94%A8%E7%A8%8B%E5%BA%8F%E6%B7%BB%E5%8A%A0%E7%89 %88%e6%9c%ac%e4%bf%a1%e6%81%af.html
QT adds version information to the application (settings for RC files, available with QT built-in variables)