How to run c++

王林
Release: 2019-11-01 15:58:21
Original
10029 people have browsed it

How to run c++

In order for the machine to recognize and run the program, each statement must be converted into a low-level machine language instruction, and then the instructions must be packaged in the format of an executable target program and stored in a binary disk file stored in the form. Taking the C program as an example, the conversion process is roughly divided into four steps: preprocessing, compilation, assembly, and linking.

Detailed steps:

1. The preprocessor modifies the original c program according to the command starting with the character #, and the result is another c program, usually starting with .i as file extension.

2. The compiler translates the text file hello.i into hello.s, which contains an assembly language program.

3. The assembler translates the assembler into machine language instructions, packages these instructions into the format of a relocatable object program, and saves the result in hello.o.

3. In the linking phase, the linker (ld) program is responsible for processing this merging, and the result is a hello file, which is an executable object file and can be loaded into memory and executed by the system.

4. Execute the program. Once the code and data in the target file hello are loaded into main memory, the processor begins executing the main machine language instruction, copying the string from main memory to the register, and outputting it to the screen.

Recommended tutorial: c tutorial

The above is the detailed content of How to run c++. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!