Getting started with C programming language

GCC's Doc--gcc-5-doc is a very ugly written work by the organization.

The gcc-5-doc is very difficult to read, and impossible for a beginner to compile the first work. The doc in html format which is over three Megabits (no graphics) is just a stack of nonsense rubbish.

Even if you read through the doc thoroughly, you can not compile the first work, 'cause it does not introduce to us this procedure. There is not any demo to show how to compile a source code into an executable one. What there exist are a bunch of options that we should care about when compiling the source code.

It is just like an instruction for an SEM telling us how to get a possible clear image, but it forgets to tell us how to start it, and it has forgotten for years. Funny?


Here is a useful link: gcc编译C语言程序的过程

Getting started with C programming language_第1张图片
C.png

It should be pointed out that this is not the one and only way to compile a C work. Let's see the following ways:

Getting started with C programming language_第2张图片
GCC.png

As it shown above, the simplest is gcc demo.c -o demo.xyz. And you may have noticed that the extension of the file is not important.

Below is a list of options passed to gcc.

mark@ASUS:~/Desktop$ gcc --help
Usage: gcc [options] file...
Options:
  -pass-exit-codes         Exit with highest error code from a phase
  --help                   Display this information
  --target-help            Display target specific command line options
  --help={common|optimizers|params|target|warnings|[^]{joined|separate|undocumented}}[,...]
                           Display specific types of command line options
  (Use '-v --help' to display command line options of sub-processes)
  --version                Display compiler version information
  -dumpspecs               Display all of the built in spec strings
  -dumpversion             Display the version of the compiler
  -dumpmachine             Display the compiler's target processor
  -print-search-dirs       Display the directories in the compiler's search path
  -print-libgcc-file-name  Display the name of the compiler's companion library
  -print-file-name=   Display the full path to library 
  -print-prog-name=  Display the full path to compiler component 
  -print-multiarch         Display the target's normalized GNU triplet, used as
                           a component in the library path
  -print-multi-directory   Display the root directory for versions of libgcc
  -print-multi-lib         Display the mapping between command line options and
                           multiple library search directories
  -print-multi-os-directory Display the relative path to OS libraries
  -print-sysroot           Display the target libraries directory
  -print-sysroot-headers-suffix Display the sysroot suffix used to find headers
  -Wa,            Pass comma-separated  on to the assembler
  -Wp,            Pass comma-separated  on to the preprocessor
  -Wl,            Pass comma-separated  on to the linker
  -Xassembler         Pass  on to the assembler
  -Xpreprocessor      Pass  on to the preprocessor
  -Xlinker            Pass  on to the linker
  -save-temps              Do not delete intermediate files
  -save-temps=        Do not delete intermediate files
  -no-canonical-prefixes   Do not canonicalize paths when building relative
                           prefixes to other gcc components
  -pipe                    Use pipes rather than intermediate files
  -time                    Time the execution of each subprocess
  -specs=            Override built-in specs with the contents of 
  -std=          Assume that the input sources are for 
  --sysroot=    Use  as the root directory for headers
                           and libraries
  -B            Add  to the compiler's search paths
  -v                       Display the programs invoked by the compiler
  -###                     Like -v but options quoted and commands not executed
  -E                       Preprocess only; do not compile, assemble or link
  -S                       Compile only; do not assemble or link
  -c                       Compile and assemble, but do not link
  -o                 Place the output into 
  -pie                     Create a position independent executable
  -shared                  Create a shared library
  -x             Specify the language of the following input files
                           Permissible languages include: c c++ assembler none
                           'none' means revert to the default behavior of
                           guessing the language based on the file's extension

Options starting with -g, -f, -m, -O, -W, or --param are automatically
 passed on to the various sub-processes invoked by gcc.  In order to pass
 other options on to these processes the -W options must be used.

For bug reporting instructions, please see:
.
mark@ASUS:~/Desktop$ 

你可能感兴趣的:(Getting started with C programming language)