Qt5.10.1 installation, environment variable configuration, common problem solving

1. Qt5.10.1 installation

It is recommended to download the offline installation package, modify the installation path during the installation process, and remove unnecessary components.


2. Environment variable configuration

My installation location is "D:\Qt", according to my actual installation path

Modify the system variable Path and add the following statement at the end

  • D:\Qt\5.10.1\mingw53_52\bin;
  • D:\Qt\Tools\mingw530_32\bin;
This is done!

Three, common problem solving

  • Qt5 console compilation cannot find #include<QApplication>

First console compile method:

1. Run cd to the file directory under Windows

2. Execute the command "qmake-project" to generate a .pro file, and use "dir/p" to view the current directory;

3. Add the statement "QT += core gui widgets" in the Qt project file .pro, which is compatible with Qt4 and Qt5;

4. Execute the command "qmake xxx.pro" to generate the makefile;

5. Execute the command "mingw32-make" to compile and link;

6. xxx.exe runs;

  • How to import image files in Qt5

1. Add resource files


2. Import image files


3. Add a statement in the position where the picture is added: ":/new/prefix1/xxx.png";



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324935239&siteId=291194637