C program generation experience

Source: Internet
Author: User

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 step 2 to generate their respective target files (*. obj). The role of this step is to unify these obj files and other library files (except dll files) required by the program into one file 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 (compile)-> connection, also called build-> Run (execute)
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.

Also, the go tool is called for trial in the debugger. Its general function is similar to execute. It can also automatically compile, connect, and execute three tasks, but it will generate breakpoints in the program, the program is debugged and checked by the programmer. In Assembly, this is called a single-step interruption. In fact, it is the execute used in the debugger.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.