QT project compilation process learning

----- QT learning summary, from the QT course learning of lecturer Xia Caojun

win system

QT's .pro file

Compile the pro file using the qmake tool to generate a Makefile, use jom to compile the Makefile in win, and use make to compile the Makefile in Linux.
insert image description here

The win environment uses the jom compiler to manually generate the pro project

insert image description here

source file writing

Notice:! Among them, only main.cpp is placed this time, and person.h and .cpp in the screenshot are only used to add to sources when viewing multiple files.
Use the console to view the output;
insert image description here
getchar prevents direct flashback;
insert image description here

Set system environment variables

qmake: in the bin directory of QT's vc; jom is in the bin directory of QT's tools;
insert image description here

Compile .pro using the cmd command line

insert image description here
insert image description here

The jom compiler compiles the Makefile

insert image description here

Command batch processing using .bat scripts

The bat script can process commands in batches, making it easy to call commands with one click;
insert image description here
insert image description here

The completion of the above will generate the final debug version of the exe

Linux system

Similar to the process of the win system; the command can refer to the .sh batch command script (the batch command processing script is bat in win, sh in Linux)

  • Add environment variables ( add path; note, in Linux, colons are used to separate different environment paths, in win, semicolons are used; $PATH is separated to represent the current existing environment path)
  • Compile .pro with qmake
  • Use make instead of jom in win to compile Makefile
  • Execute the generated executable
  • Note: If you use the sh script to execute with one click, you need to add executable permissions
    insert image description here
    insert image description here

Guess you like

Origin blog.csdn.net/qq_20467929/article/details/126236573