726 Part VI . Programming In Linux GCC (Post Office Web Site) |
|
November 30, 2007 |
726 Part VI . Programming in Linux GCC relies on file extensions to determine what kind of source code file it is, that is, in which programming language the source code is written. Table 28-1 lists the most common extensions and how GCC interprets them. Table 28-1 GCC s File Naming Conventions Extension Type .a, .so Compiled library code .c C language source code .C, .cc C++ language source code .i Preprocessed C source code .ii Preprocessed C++ source code .m Objective-C source code .o Compiled object code .S, .s Assembly language source code Compiling Multiple Source Code Files Most nontrivial programs consist of multiple source files, and each source file must be compiled to object code before the final link step. To do so, provide gcc the name of each source code file it has to compile. GCC handles the rest. The gcc invocation might resemble: $ gcc file1.c file2.c file3.c -o progname gcc would create file1.o, file2.o, and file3.o and then link them all together to create progname. As an alternative, you can use gcc s -c option on each file individually, which creates object files from each file. Then in a second step, you link the object files together to create an executable. Thus, the single command just shown becomes: $ gcc -c file1.c $ gcc -c file2.c $ gcc -c file3.c $ gcc file1.o file2.o file3.o -o progname
In case you need quality webspace to host and run your web applications, try our personal web hosting services.

November 30, 2007
Leave a Reply