From 0faf7422d6bd51b87664b9ea6fa4967ba3043843 Mon Sep 17 00:00:00 2001 From: mcarton Date: Thu, 7 May 2015 19:22:59 +0200 Subject: [PATCH] Improve gcc and include g++, clang and clang++ --- eg/examples/clang++.md | 1 + eg/examples/clang.md | 1 + eg/examples/g++.md | 1 + eg/examples/gcc.md | 38 +++++++++++++++++++++++++++++++++----- 4 files changed, 36 insertions(+), 5 deletions(-) create mode 120000 eg/examples/clang++.md create mode 120000 eg/examples/clang.md create mode 120000 eg/examples/g++.md diff --git a/eg/examples/clang++.md b/eg/examples/clang++.md new file mode 120000 index 0000000..fcf50fa --- /dev/null +++ b/eg/examples/clang++.md @@ -0,0 +1 @@ +gcc.md \ No newline at end of file diff --git a/eg/examples/clang.md b/eg/examples/clang.md new file mode 120000 index 0000000..fcf50fa --- /dev/null +++ b/eg/examples/clang.md @@ -0,0 +1 @@ +gcc.md \ No newline at end of file diff --git a/eg/examples/g++.md b/eg/examples/g++.md new file mode 120000 index 0000000..fcf50fa --- /dev/null +++ b/eg/examples/g++.md @@ -0,0 +1 @@ +gcc.md \ No newline at end of file diff --git a/eg/examples/gcc.md b/eg/examples/gcc.md index f38e225..ab866ac 100644 --- a/eg/examples/gcc.md +++ b/eg/examples/gcc.md @@ -1,30 +1,58 @@ # gcc -compile main.c (default executable output is a.out) +compile *main.c* (default executable output is *a.out*) gcc main.c -compile main.c into an outfile file main.o +compile *main.c* into an outfile file main.o gcc main.c -o main.o -compile main.c and enable all warnings +compile *main.c* and enable all warnings gcc -Wall main.c -compile main.c but do not run the linker +compile *main.c* but do not run the linker gcc -c main.c +do not compile, only run the linker + + gcc main.o + + +compile with mamimum optimization level + + gcc -O3 main.c + + +compile with size optimization enabled + + gcc -Os main.c + + +assemble *main.c* (default output is *main.s*) + + gcc -S main.c + + # Basic Usage -Compile a file using the GNU compiler: +Compile a file using the GNU compiler: gcc + +# Note + +`gcc` can be replaced by `g++` to compile C++ files. +It can also be replaced by `clang` and `clang++` to use the Clang compiler +instead, which has the same command line interface. + +