当前位置:网站首页>How to create a new project with VS+Qt
How to create a new project with VS+Qt
2022-08-09 16:17:00 【Nicolas0311】
The reason for this guideline is that two new people have recently entered the company.
One, just graduated and studied MFC.
One, I have many years of electrical experience and have taught myself C#.
But our company uses VC++ and Qt for projects.The pain of these two people is also very painful for me.In line with the principle of not giving up and not giving up, write some simple guidelines for them, and others who have encountered similar situations can refer to them.
Compilation environment: VS2012+Qt5.2.1 (off-topic: don't ask me why it's not the latest version, if you want to ask, ask the company's predecessors. In fact, these two versions are because the previous projects used some old external libraries,There is still a lot of code, and the writing method is relatively old. After a period of code sorting, it can be smoothly upgraded to VS and Qt that support newer).
1 Install VS2012 (self-query tutorial)
2 Install Qt5.2.1 (self-query tutorial)
3 Install the Qt-VS plugin
The plugin will add a wizard template for the Qt project to VS, which is used to create a Qt project in VS, and connect with the Qt compiler installed above, so that the Qt project can be compiled directly in VS
4 Creating a Qt Project in VS

5 Make some selections and settings based on the wizard template's predefined options
This step can basically do nothing, keep going next step, next step, next step.
6 compile and run
When compiling, you may encounter such a problem: the include file cannot be opened: "GLES2/gl2.h": No such file or directory
In VS, select the current project -> Properties -> C/C+±->General->Additional include directory->Header file directory, add **$(QTDIR)\include\QtANGLE**
At this time, a VS+Qt project program that has a form, can run, and has no function is completed.
7 Brief Description of Project File
demo1.ui is a visible-is-what-you-get UI interface design file (similar to MFC's demo1.rc, similar to C#'s Form1.cs).
demo1.qrc is the file used to add resources.
demo1.cpp, demo1.h is the implementation code of the Qt window class of the UI interface demo1.ui.
main.cpp is the entry point of the application, which calls the Qt window class demo1.
8 UI interface design through Qt Designer
After demo1.ui is opened with Qt Designer, design the interface according to your own needs.After the setting is complete, save it, go back to VS and press F7 to recompile demo1.ui.
The Qt plugin installed in VS will call the Qt compilerMoc, Uic recompile and generate the corresponding interface code, the generated files are as follows: moc_demo1.cpp, ui_demo1.h
9 Add external library files (no matter what project will inevitably call external files, whether it is customer or supplier)
There are generally two types of external library files.
- xxx.h header file, xxx.dll dynamic library file: This type can only call LoadLibrary(), GetAddress(), FreeLibrary() by dynamic call.
- xxx.h header file, xxx.dll dynamic library file, xxx.lib static library file: this type is more common, directly #include "xxx.h header file", #pragma comment(lib, "xxx.lib”) static library file, the xxx.dll dynamic library file can be placed in the exe.
The general new project creation process is now complete.
边栏推荐
- 用户如何正确去认识程序化交易?
- [Basic version] Integer addition, subtraction, multiplication and division calculator
- How to achieve stable profit through the stock quantitative trading interface?
- CV复习:过拟合、欠拟合
- 如何将List<Map>进行分组数值计算合并排序
- 突然想分析下房贷利率及利息计算
- Mysql两个引擎对比
- My MySQL database was attacked and deleted for ransom, forcing me to use all my might to recover data
- 经典面试题 之 TCP 三次握手/ 四次挥手
- [ERR] 1273 - Unknown collation: ‘utf8mb4_0900_ai_ci‘
猜你喜欢
随机推荐
How do users correctly understand programmatic trading?
数组学习笔记
经典面试题 之 TCP 三次握手/ 四次挥手
复数与复数域
Two-dimensional array to realize the eight queens problem
For programming trading, focusing on forecast or on countermeasures?
OpenCV - Matrix Operations Part 3
Bessel function
focal loss原理及简单代码实现
What do professional quantitative traders think about quantitative trading?
What is an index in MySql?What kinds of indexes are commonly used?When does an index fail?
物理学专业英语(词汇整理)--------07
MySql中什么是索引?常用的索引有哪些种类?索引在什么情况下会失效?
一些需要思考的物理问题
常用类学习
Startup error: Caused by: org.apache.ibatis.binding.BindingException summary solution
FilenameFilter filters filenames
浅谈ArraryList的浅克隆和深克隆
走得通,看得见!你的交通“好帮手”
Matlab修改Consolas字体









