C Programming related file suffix
 
. a&http://www.aliyun.com/zixun/aggregation/37954.html ">NBSP; Static Library (archive)
. C C Source code (requires compilation preprocessing)
. h C Source Dock files
. I c source code (no compilation preprocessing required)
. O Object File
. S assembly Language Code
. So dynamic Library
 
A single source file generates an executable program
 
Here is a simple "Hello, ubuntu" program source code:
 
/* HELLOUBUNTU.C *
#include <stdio.h>
int main (int argc,char *argv[])
{
printf ("Hello, ubuntu\n");
return 0;
}
 
The simplest way to compile the code as an executable is to save the code as a file helloubuntu.c and execute the following command:
 
$ Gcc-wall HELLOUBUNTU.C
The compiler recognizes a C source code file by checking the suffix name of the file specified on the command line. GCC Default action: Compile source code file to generate object file, link object file get executable program, delete object file. The compiler takes the default a.out because the file name of the executable program is not specified on the command line. Enter a program name on the command line to perform and display the results:
 
$/a.out
Hello, Ubuntu
 
Option-O is used to specify the file name of the generated executable program. The following command generates an executable program named Helloubuntu:
 
$ gcc-wall Helloubuntu.c-o Helloubuntu
 
Enter the program name on the command line to execute it as follows:
 
$/helloubuntu
Hello, Ubuntu
 
Note Use the LM parameter if it is useful to a standard library, such as the MATH.H library, that is not a default call for GCC
 
Source file Generation Object file
 
Option-C instructs GCC to compile the source code file, but keep the object file on disk and skip the link object file to generate the executable file. In this case, the default output file's filename is the same as the code file name, except that the suffix is changed to. O. For example, the following command generates an object file named HELLOUBUNTU.O:
 
$ gcc-c-wall helloubuntu.c
 
Option-O can be used to specify the file name of the generated object file. The following command produces an object file named KUBUNTU.O:
 
$ gcc-c-wall Helloubuntu.c-o KUBUNTU.O
 
When building object libraries or generating a series of object files for later links, a command can generate the corresponding object files from multiple source files. The following command generates object files UBUNTU.O, KUBUNTU.O, and XUBUNTU.O:
 
$ gcc-c-wall ubuntu.c kubuntu.c xubuntu.c