GCC(the GNU Compiler Collection)
- GCC homepage at GNU project
- GCC Compiler Collection - Wikipedia
GCC online documentation
GCC related linux tools
- ldd: see which dynamic library the program used.
- nm: see the symbol in program
- strip: make the program smaller.
GCC Main parameters
- -g: "*", Keep the debugging message in the compiled program.
- -o: "*.o", Specify a target name, default is a.out.
- -x language filename: Specify explicitly the language for the following input files (rather than letting the compiler choose a default based on the file name suffix).
- -x none: Turn off any specification of a language.
- -c: "*.o", Only preprocessing, complication, assemble,
- -E: "*.txt", Only preprocessing, you may want to use
gcc -E binarySearch.c > preprocessing.txt_
, due to the fact it will generate a 800+ lines of code even a hello-world program.
- -C: "*.txt", Only preprocessing, but save the comments information.
- -S: "*.s", Stop after the stage of compilation proper, do not assemble.
- -M: Generate information related to files.
- -MM: Generate information related to files but ignore dependency caused by #include
- OO: No optimization.
- -O/-O1: Optimize code.
- O2: Further optimization.
- O3: More further optimization.
- -shared: Generate shared object, file suffix is
.so
.
- -static: Forbid shared link.