Introduction to Qt Development Tools


Reprint address: http://www.cnblogs.com/tangkaixuan/p/6504105.html
 
1.5 Understanding Development Tools

This section specifically introduces the GNU toolsets, MinGW, CMake and Qt toolsets that are commonly used in development. Although these tools do not need to be fully learned, the basic concepts and uses must be clear.

1.5.1 GNU toolset

In the 1980s, computers were all luxury items. The most famous operating system was the Unix family. At that time, there were no Windows, Linux, etc. Unix systems were all commercial software, and the application software inside was also commercial software. is a closed environment. Systems programmer Richard M. Stallman (RMS) founded the distinctive GNU project (GNU's Not Unix) in this environment, and the Free Software Foundation (FSF), which promotes free software development. The GNU project is to create a free Unix-like system, so it has developed many open source system tools, the most famous of which is GCC (GNU Compiler Collection, GNU Compiler Suite). In the GNU toolset, a few commonly encountered during development are listed below (these tools are usually located in the /usr/bin/ directory on Linux or Unix systems):

gcc GNU C language compiler.
g++ GNU C++ language compiler.
ld The GNU linker links object files and library files to create executable programs and dynamic link libraries.
With Generate static library.a, can edit and manage static link library.
make The generator can automatically compile and link to generate executable programs or library files according to makefiles.
gdb Debugger, used to debug executable programs.
ldd View the shared library (extension .so, also called dynamic link library) that the executable depends on.


GNU Project Homepage:  http://www.gnu.org/ 
FSF Foundation Homepage:  http://www.fsf.org

 

1.5.2 MinGW

Originally, GNU tools were only available in Linux/Unix systems. With the widespread use of Windows systems, in order to use GNU tools in Windows systems, the MinGW (Minimalist GNU for Windows) project was born, and MinGW can be used to generate files in Windows. exe program and dll link library. It should be noted that there are some differences between MinGW and the GNU toolset in Linux/Unix systems:

  • Tools in MinGW have the extension .exe, and tools in Linux/Unix systems usually have no extension.
  • The generator file in MinGW is named mingw32-make.exe, and in Linux/Unix systems, it is called make.
  • MinGW links to the *.a library reference file when linking, and the generated executable program depends on *.dll at runtime, while Linux/Unix systems use *.so when linking and running.

In addition, there is no ldd tool in MinGW, because Windows does not use .so shared library files. If you want to view the dependencies of executable files in Windows, you need to use Microsoft's own Dependency Walker tool. In Windows, the extension of dynamic library is .dll. MinGW can use dlltool to generate the files needed to create and use dynamic link library, such as .def and .lib.

MinGW was originally used to generate 32-bit programs. With the popularity of 64-bit systems, the MinGW-w64 project was separated from MinGW, which supports generating 64-bit and 32-bit programs at the same time. The MinGW repository of Qt is generated using the toolset in the MinGW-w64 project. The MinGW 4.9.1 installed in the previous section 1.3 is the toolset released in the MinGW-w64 project.

In addition, since MinGW itself mainly compiles and links tools, header files, and library files, it does not include a shell environment such as system management and file operations, which is not enough for developers who want to use Unix-like commands. . Therefore, MinGW officially launched MSYS (Minimal SYStem), which is equivalent to a small Unix system environment deployed in Windows system. Many Unix/Linux command line tools and configuration files are transplanted, which is an extension to MinGW. MSYS is a convenience for those who are familiar with Unix/Linux system environment or who want to try to learn Unix/Linux system. The installation and upgrade of MSYS and MinGW are implemented through its official mingw-get tool, which is managed by unified download, installation and management. For the MinGW-w64 project, its corresponding small system environment is called MSYS2 (Minimal SYStem 2). MSYS2 is a derivative version of MSYS, which not only supports 64-bit and 32-bit systems, but also has its own unique package management tool. The pacman software management tool is transplanted into the Arch Linux system, so after installing MSYS2, you can download and install the software directly through pacman, and it can automatically resolve dependencies and facilitate system upgrades. After installing MSYS2, you don't need to download MinGW-w64 yourself, you can directly use the pacman command to install the compilation link tool and git tool.

MinGW project homepage (including MSYS):  http://www.mingw.org/ 
MinGW-w64 project homepage:  http://sourceforge.net/projects/mingw-w64/ 
MSYS2 project homepage:  http://sourceforge.net/ projects/msys2/

1.5.3 CMake

CMake (Cross platform Make) is an open source cross-platform automated build tool that can generate various makefiles or project files across platforms, and supports the use of various compilation tools to generate executable programs or link libraries. CMake does not compile programs by itself. It is equivalent to using its own build script CMakeLists.txt to call various compilation toolsets to generate executable programs or link libraries. Generally, the makefiles used for compiling programs are more complicated, and it is more troublesome to write them yourself. With CMake, you can write a relatively simple CMakeLists.txt, and CMake can automatically generate makefiles according to CMakeLists.txt, and then you can use make to generate executable programs. or link library.

In this tutorial, the Qt official qmake tool is used to generate the makefile, and CMake is not used. The reason why CMake is mentioned here is that many programs in the entire KDE desktop environment are built with CMake scripts, and cross-platform programs/libraries such as Boost C++ Libraries, OpenCV, LLVM, Clang, etc. are also built with CMake scripts. . If you come into contact with these things in the future, you need to understand CMake.

CMake project homepage:  http://www.cmake.org/
KDE project homepage:  https://www.kde.org/

1.5.4 Qt toolset

The Qt official development environment installation package has its own special development tools, and the qmake command has been used before. qmake is the core tool for Qt development. It can generate Qt project file .pro and automatically generate project Makefile. Here is a list of commonly used Qt development tools as follows:

qmake The core project construction tool can generate cross-platform .pro project files, and can generate corresponding Makefiles according to different operating systems and compilation tools for building executable programs or link libraries.
uic User Interface Compiler, the user interface compiler, Qt uses the .ui file in XML syntax to define the user interface, and uic generates the C++ code header file used to create the user interface according to the .ui file, such as ui_*****.h.
power Meta-Object Compiler, meta-object compiler, moc processes the Q_OBJECT macro in the class definition of the C++ header file, it will generate a source code file, such as moc_*****.cpp, which contains the meta-object code of the corresponding class, meta-object code Object code is mainly used to implement Qt's signal/slot mechanism, runtime type definition, and dynamic property system.
rcc Resource Compiler, the resource file compiler, is responsible for compiling the .qrc resource file during the project construction process and embedding the resource into the final Qt program.
qtcreator The integrated development environment includes many functions such as project generation management, code editing, graphical interface visual editing, compilation generation, program debugging, context help, version control system integration, etc. It also supports program generation and deployment for mobile phones and embedded devices.
assistant Qt assistant, help document browsing and query tool, help documents, sample codes, etc. of all modules and development tools of Qt library can be retrieved.
designer Qt Designer, specialized in visual editing GUI (what you see is what you get), generates .ui files for use in Qt projects.
linguist For Qt linguists, the translatable strings are wrapped with the tr() macro in the code. The developer can use the lupdate command to generate the string file .ts to be translated for the project, use linguist to translate .ts in multiple languages, and use the lrelease command after translation is complete Generate .qm file, and then it can be used for multi-language interface display.
qmlscene In Qt 4.x, qmlviewer was used for prototyping and testing of QML programs, and Qt 5 replaced the old qmlviewer with qmlscene. The new qmlscene additionally supports scenegraph, a new feature in Qt 5.

Guess you like

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