Home>Article>Backend Development> What is the suffix of the generated file after the C language source file is compiled?

What is the suffix of the generated file after the C language source file is compiled?

青灯夜游
青灯夜游 Original
2020-11-02 09:45:10 52222browse

The suffix of the generated file after compilation of the c language source file is ".obj". After the C language source program is compiled by the compiler, a file with the suffix ".obj" is generated. Finally, the software called the "linker" connects this ".obj" file with various library functions to generate a Executable files with the suffix ".exe".

What is the suffix of the generated file after the C language source file is compiled?

The operating environment of this tutorial: windows7 system, c99 version, Dell G3 computer.

After the c language source file is compiled, the suffix of the generated file is ".obj".

The suffix of the C language source file is ".c", the suffix of the compiled file is ".obj", and the suffix of the connected executable file is ".exe".

Steps to create a program in C language:

  • Editing: It is to create and modify the source code of the C program - the program we write is called source code.

  • Compilation: It is to convert the source code into machine language. The output of the compiler becomes the object code, and the file that stores them is called the object file. The extension is .o or .obj. (This part of compilation refers to the assembler compiling assembly language or the compiler compiling high-level language)

  • Linking: The linker combines the source code from various modules generated by the compiler, and then from Add necessary code modules to the program library provided by C language and form them into an executable file. The extension is .exe under Windows and has no extension under Unix.

  • Execution: Run the program.

After the C language source program is compiled by the C language compiler, a binary file (called an object file) with a suffix of ".obj" is generated, and finally a binary file called a "connection file" is generated. "Program" (Link) software connects this ".obj" file with various library functions provided by the C language to generate an executable file with the suffix ".exe". Obviously C language cannot be executed immediately.

Related introduction

  • Source program: The program can be written in high-level language or assembly language. A program written in high-level language or assembly language is called source program. The extension of C language source program is ".c". The source program cannot be executed directly on the computer, and a "compiler" needs to be used to compile the source program into a binary form of code

  • Target program: The source program is compiled by the "compiler" The binary code is called the target program. The extension of the target program is ".obj".

  • Although the target code is already a machine instruction, it cannot be run yet because the target program has not solved the function calling problem. Each target program needs to be connected to the library function to form a complete and feasible system. execute program.

  • Executable program: The target program is connected with the library function to form a complete program that can be executed independently under the operating system, which is called an executable program. The extension of the executable program is ".exe".

For more programming-related knowledge, please visit:Programming Teaching! !

The above is the detailed content of What is the suffix of the generated file after the C language source file is compiled?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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