Thank you for the invitation. This question is really big. I don’t know what you don’t understand, so I can only try to explain some things. Others require you to read about compilation principles, graphics, operating systems, etc. [1] First of all, the operating system can only accept binary codes. There is no objection to this. The operating system builds a bridge between the upper software and the underlying hardware. The Intel X86 architecture CPU we currently use is the For example, the instruction set format it accepts is obviously different from that of ARM or other CPUs such as Power PC. For this, you need to read the classic Intel 8086 instruction set manual: http://www.intel. com/content/www/us/en/processors/architectures-software-developer-manuals.html It’s all in English, but it describes how Intel chips run assembly language. Based on your question, what the operating system does is to act as a middle layer (a famous saying in the computer field: any problem in the field of computer science can be solved by adding an indirect middle layer), then the operating system is the underlying graphics card A bridge between applications. Of course, Microsoft's display method uses DirectX and GDI to encapsulate the operation of the graphics card.
[2] What the compiler does is to convert the source code into this binary process. The technology used in the middle is, as you said, compilation and linking. But the compiler is also a layered structure, generally divided into front-end and back-end. The front-end is to adapt to different languages. The same compiler, such as GCC, supports C++/C/Objective-C, etc., and the back-end adapts Different architectures, such as adapting to Arm/X86/PowerPC, etc. However, this compilation technology may be more complicated. There are compiled codes that can directly run on the operating system, such as C++ and C codes, and there are also compiled codes that need to be run on the VM, such as Java. Taking C++ as an example, this process It is the process of turning the cpp source code into 1) a recognizable binary. However, the binary here is not simply an assembled text, but a format that depends on a specific operating system. Windows becomes the PE format, and LINUX is called ELF format, which also explains why Windows programs cannot be started by default under Linux because the format is different.
[3] Then based on your question, in this process, when doing GUI programming, the compiler does nothing else. It is to compile and connect your own code with the existing GUI library, and then form an executable During the file process, when the program is running, your GUI program will call existing GUI libraries such as Qt/MFC, etc., and the GUI library will complete the rendering of graphics images, so in essence, Qt is no different from other things. A library for external calls.
[4] You double-click the program to start it. This process is that the operating system sends a loading command to the program to load the program into the memory for use. You can also start the program with a graphical interface from the command line. There is nothing mysterious about this. of.
A program with an interface, I personally feel it is a variant of a console program. It expands the graphical interface and input and output functions on the basis of the console program. Its internal implementation mechanism also calls the drawing function that comes with Windows. For example, in MFC, the underlying interface is implemented by the system, and developers only need to use MFC's message passing mechanism to implement functional design. My personal understanding is limited, I hope it can help you
Console programs can also be run directly by double-clicking =_=# Programs with GUI generally call the system's GUI interface to draw pictures and hide the console to run. General GUI programs have a part similar to an infinite loop to prevent the process from automatically closing. If you create an infinite loop in the console and then double-click, you will also see a console that does not close automatically. At this time, you should ask a professional @vczh
It is also compiled by the compiler, but the parameters are different, and a certain value in the PE header of the generated exe file is different, so that the system can run it with the win32 subsystem, so there is no command line window
Thank you for the invitation. This question is really big. I don’t know what you don’t understand, so I can only try to explain some things. Others require you to read about compilation principles, graphics, operating systems, etc.
[1] First of all, the operating system can only accept binary codes. There is no objection to this. The operating system builds a bridge between the upper software and the underlying hardware. The Intel X86 architecture CPU we currently use is the For example, the instruction set format it accepts is obviously different from that of ARM or other CPUs such as Power PC. For this, you need to read the classic Intel 8086 instruction set manual: http://www.intel. com/content/www/us/en/processors/architectures-software-developer-manuals.html
It’s all in English, but it describes how Intel chips run assembly language.
Based on your question, what the operating system does is to act as a middle layer (a famous saying in the computer field: any problem in the field of computer science can be solved by adding an indirect middle layer), then the operating system is the underlying graphics card A bridge between applications. Of course, Microsoft's display method uses DirectX and GDI to encapsulate the operation of the graphics card.
[2] What the compiler does is to convert the source code into this binary process. The technology used in the middle is, as you said, compilation and linking. But the compiler is also a layered structure, generally divided into front-end and back-end. The front-end is to adapt to different languages. The same compiler, such as GCC, supports C++/C/Objective-C, etc., and the back-end adapts Different architectures, such as adapting to Arm/X86/PowerPC, etc. However, this compilation technology may be more complicated. There are compiled codes that can directly run on the operating system, such as C++ and C codes, and there are also compiled codes that need to be run on the VM, such as Java. Taking C++ as an example, this process It is the process of turning the cpp source code into 1) a recognizable binary. However, the binary here is not simply an assembled text, but a format that depends on a specific operating system. Windows becomes the PE format, and LINUX is called ELF format, which also explains why Windows programs cannot be started by default under Linux because the format is different.
[3] Then based on your question, in this process, when doing GUI programming, the compiler does nothing else. It is to compile and connect your own code with the existing GUI library, and then form an executable During the file process, when the program is running, your GUI program will call existing GUI libraries such as Qt/MFC, etc., and the GUI library will complete the rendering of graphics images, so in essence, Qt is no different from other things. A library for external calls.
[4] You double-click the program to start it. This process is that the operating system sends a loading command to the program to load the program into the memory for use. You can also start the program with a graphical interface from the command line. There is nothing mysterious about this. of.
A program with an interface, I personally feel it is a variant of a console program. It expands the graphical interface and input and output functions on the basis of the console program. Its internal implementation mechanism also calls the drawing function that comes with Windows. For example, in MFC, the underlying interface is implemented by the system, and developers only need to use MFC's message passing mechanism to implement functional design. My personal understanding is limited, I hope it can help you
Select static compilation in the project properties, and the compiled exe file can be run on other computers
Console programs can also be run directly by double-clicking =_=#
Programs with GUI generally call the system's GUI interface to draw pictures and hide the console to run.
General GUI programs have a part similar to an infinite loop to prevent the process from automatically closing.
If you create an infinite loop in the console and then double-click, you will also see a console that does not close automatically.
At this time, you should ask a professional @vczh
It is also compiled by the compiler, but the parameters are different, and a certain value in the PE header of the generated exe file is different, so that the system can run it with the win32 subsystem, so there is no command line window