首页 > 编程语言 >Unified tutorial for dynamic and static compilation of Qt projects for C++

Unified tutorial for dynamic and static compilation of Qt projects for C++

时间:2022-12-31 18:36:45浏览次数:74  
标签:Unified Qt lib compilation project static plugins QTDIR

Environment installation

Requirements download

Requirements Links
Qt 5.7 dynamic compiler qt-opensource-windows-x86-msvc2015-5.7.1
Compiled Qt 5.7 static compiler qt5-x86-static-release
Visual Studio 2015 Microsoft Visual Studio 2015
Qt VS AddIn qt-vsaddin-msvc2015-2.4.3.vsix
MinGW mingw-w64-install.exe
Visual Studio Code https://code.visualstudio.com/Download

Installation order

  1. Install Qt 5.7 dynamic compiler
  2. Install Visual Studio 2015
  3. Install Qt VS AddIn
  4. Install MinGW
  5. Install Visual Studio Code

Environment configuration

Dependencies

  1. Open the project with VS2015, right click Project - Properties
  2. Configure the selection Release
  3. Open Configuration Properties - C/C++ - Code Generation - Runtime Library and select Multithreading (/MT)
  4. Open Configuration Properties - Linker - Input - Additional Dependencies and paste in the following long string of characters:
$(QTDIR)\lib\qtmain.lib;$(QTDIR)\lib\Qt5Widgets.lib;$(QTDIR)\plugins\platforms\qwindows.lib;winspool.lib;shlwapi.lib;rpcrt4.lib;$(QTDIR)\lib\Qt5PlatformSupport.lib;$(QTDIR)\plugins\imageformats\qdds.lib;$(QTDIR)\plugins\imageformats\qicns.lib;$(QTDIR)\plugins\imageformats\qico.lib;$(QTDIR)\plugins\imageformats\qtga.lib;$(QTDIR)\plugins\imageformats\qtiff.lib;$(QTDIR)\plugins\imageformats\qwbmp.lib;$(QTDIR)\plugins\imageformats\qwebp.lib;$(QTDIR)\lib\Qt5Gui.lib;comdlg32.lib;oleaut32.lib;imm32.lib;winmm.lib;glu32.lib;opengl32.lib;gdi32.lib;$(QTDIR)\lib\qtharfbuzzng.lib;$(QTDIR)\lib\Qt5Core.lib;kernel32.lib;user32.lib;shell32.lib;uuid.lib;ole32.lib;advapi32.lib;ws2_32.lib;mpr.lib

Qt configuration

  1. Complete the additional dependencies configuration from the previous step
  2. Unzip the compiled Qt static compiler qt5-x86-static-release
  3. Open the project with VS2015, click [Qt VS Tools] -> [Qt Options] -> [Add], select the Qt static compiler path unzipped just now and confirm
  4. Select qt5-x86-static-release in the [Default Qt/Win version] drop-down menu, click OK

Debug

  1. Right-click the project directory and open the project with VSCode
  2. Confirm that the includePath of c_cpp_properties.json in the project is correctly configured with the Qt 5.7 dynamic compiler path installed earlier, and the compilerPath is correctly configured with the environment variable path of MinGW
  3. Click Run - Start Debug (or press F5 directly on the keyboard to start Debug mode)

Release

  1. Open the project with VS2015
  2. Select Release mode x86
  3. Select Build - Rebuild Solution
  4. Take out the .exe file from Release in the project directory, which is the file for release

标签:Unified,Qt,lib,compilation,project,static,plugins,QTDIR
From: https://www.cnblogs.com/georgechou/p/17017063.html

相关文章

  • Qt编写雷达模拟仿真工具(模拟点/歼击机/航母/发射导弹/爆炸效果/激光雷达等)
    一、简单介绍雷达模拟仿真工具,主要通过模拟点模拟相关物体,方位、航向角、距离、速度,并且显示相关详情信息可建立跟踪线建立与模拟点联系。可自定义更换模拟点背景达到更加......
  • MAC之PyQt5环境
    一,安装模块1,pyqt5pip3installpyqt52,pyqt5-toolspip3installpyqt5-tools二,pyqt5designer的位置安装了pyqt5后就有了:/Users/hz/WorkSpace/Python/Qt/venv/lib/python3.......
  • qt 增加新窗口
    添加UI界面新建里面选择qddesignerformclass,就会自动生成ui文件,c和h文件。使用新ui在mainwindow.cpp中,可以引入新ui的头文件,然后在button的槽函数中,n......
  • 记一次 QT VS Tools 无法配置 version 的问题
    问题概述:在QTVSTools拓展工具中添加多个qt版本的静态库时,发现输入完Name和Path之后点击OK,新输入的version路径并没有保存成功测试的QTVSTools版本:2.9.4......
  • 使用Python3+PyQT5+Pyserial实现简单的串口工具方法
    练手项目,先上图先实现一个简单的串口工具,为之后的上位机做准备代码如下:github下载地址pyserial_demo.pyimportsysimportserialimportserial.tools......
  • 【Qt】问题解决:Unable to create a debugging engine.
    ......
  • Qt总结_对象模型_组件parent的理解
    标准C++对象模型在运行时效率方面卓有成效,但是在某些特定问题域下的静态特性就显得捉襟见肘。GUI界面需要同时具有运行时的效率以及更高级别的灵活性。为了解决这一问题,Q......
  • Qt总结
    (1)app的生命周期长于组件的的生命周期。否则这可是Qt编程的大忌,下面是错误的例子。#include<QApplication>#include<QLabel>intmain(intargc,char*argv[]){QA......
  • Qt实现俄罗斯方块
    #include<QtCore>#include<stdlib.h>#include"tetrixpiece.h"voidTetrixPiece::setRandomShape(){setShape(TetrixShape(QRandomGenerator::global()->bounded(7)+......
  • Qt之QTableView
    前言在目前PC端的桌面程序中,界面框架主要流行的基本上还是那几个,就本人而言,平时用的还是Qt框架多一些。这里我使用Qt的表格部件作为样本记录学习笔记。语言或者框架永远......