To generate a C program, follow these steps: 1. Write text code to generate a C or CPP file. At this time, it is still text; 2. Compile, that is, compile. The C Compilation Program analyzes the lexical and syntaxes of the code you write, finds and reports errors, and fails to compile the Code if any errors occur. If no error occurs, the intermediate code is generated. The extension is OBJ, Which is binary; 3. connection, called Link in assembly, is called build in C. It is used to generate executable EXE files. The source code of a program can be composed of multiple files. These files are compiled separately in the second step to generate their respective target files. The role of this step is to split these OBJ files and other library files required by the Program (DLL ), to form a single EXE file. This EXE file can be run directly in the operating system. The second step above has a code optimization after the intermediate code generation, which is not detailed here.
Compile and build correspond to the compilation and connection processes respectively. Execute means to execute, that is, to run it after the EXE file is generated. If your program has been modified, click this item and a pop-up window will pop up asking you if you want to re-compile and connect, that is, it can automatically complete the previous work. That is to say, the Execute function in the VC menu is as follows: 1. When the program is modified or the previous compilation and connection work is not performed Execute = compile + build + execution; 2. After the program is compiled and connected Execute is only an execution task and does not do the first two tasks. When the program has been modified, select execute to recompile and connect the modified content, but sometimes errors occur. In this case, select rebuild all under the build menu, recompile and connect all files.
In short, the generation of C program can be illustrated as follows: Compile the source code-> compile-> connect, also called generate-> RUN The extension of the files processed in each phase is: C or CPP-> obj-> exe.
The C program is compiled and executed, and another program is interpreted and executed. For example, in Java, its source file is compiled to form intermediate code with the extension of class, and then the EXE file is generated without connection, instead, you can directly. the intermediate code of class is obtained on the Java Virtual Machine Platform and interpreted and executed by the interpreter. This method is less efficient but flexible. |