Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve gcc and include g++, clang and clang++ #22

Merged
merged 1 commit into from
May 17, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions eg/examples/clang++.md
1 change: 1 addition & 0 deletions eg/examples/clang.md
1 change: 1 addition & 0 deletions eg/examples/g++.md
38 changes: 33 additions & 5 deletions eg/examples/gcc.md
Original file line number Diff line number Diff line change
@@ -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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow the -S flag is awesome! I didn't know about that one.




# Basic Usage

Compile a file using the GNU compiler:
Compile a file using the GNU compiler:

gcc <file>



# 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.