GNU project C and C++ compiler
-s Remove all symbol table and relocation information from the executable.
-c Compile or assemble the source files, but do not link. The linking stage simply is not done. The
ultimate output is in the form of an object file for each source file.
By default, the object file name for a source file is made by replacing the suffix .c, .i, .s, etc.,
Unrecognized input files, not requiring compilation or assembly, are ignored.
Produce debugging information for use by GDB. This means to use the most expressive format available
(DWARF 2, stabs, or the native format if neither of those are supported), including GDB extensions if
at all possible.
Add the directory dir to the list of directories to be searched for header files. Directories named
by -I are searched before the standard system include directories. If the directory dir is a
standard system include directory, the option is ignored to ensure that the default search order for
system directories and the special treatment of system headers are not defeated . If dir begins with
"=", then the "=" will be replaced by the sysroot prefix; see --sysroot and -isysroot.
Search the library named library when linking. (The second alternative with the library as a
separate argument is only for POSIX compliance and is not recommended.)
It makes a difference where in the command you write this option; the linker searches and processes
libraries and object files in the order they are specified. Thus, foo.o -lz bar.o searches library z
after file foo.o but before bar.o. If bar.o refers to functions in z, those functions may not be
The linker searches a standard list of directories for the library, which is actually a file named
liblibrary.a. The linker then uses this file as if it had been specified precisely by name.
The directories searched include several standard system directories plus any that you specify with
Normally the files found this way are library files---archive files whose members are object files.
The linker handles an archive file by scanning through it for members which define symbols that have
so far been referenced but not defined. But if the file that is found is an ordinary object file, it
is linked in the usual fashion. The only difference between using an -l option and specifying a file
name is that -l surrounds library with lib and .a and searches several directories.
Pretend the symbol symbol is undefined, to force linking of library modules to define it. You can
use -u multiple times with different symbols to force loading of additional library modules.
Options for Directory Search
These options specify directories to search for header files, for libraries and for parts of the
Place output in file file. This applies regardless to whatever sort of output is being produced,
whether it be an executable file, an object file, an assembler file or preprocessed C code.
If -o is not specified, the default is to put an executable file in a.out, the object file for
source.suffix in source.o, its assembler file in source.s, a precompiled header file in
source.suffix.gch, and all preprocessed C source on standard output.