GCC compiler
gcc hello.c -o hello # hello.c will be compiled into an executable file hello
gcc -E hello.c -o hello.i # hello.c into the converted file pretreatment hello.i
GCC -S hello.c -o hello.s # hello.c converted into the assembler file hello.s
GCC -c hello.c -o hello.o # hello.c converted into binary hello.o
GCC -I -I dir # hello.c -o Hello path behind the increase, looking at the specified path header file dir
gcc -Wall hello.c -o hello # display all warning messages during compilation
Program gcc -g hello.c -o hello # with debug information, you can debug with GDB
gcc -v hello.c -o hello # display commands to perform the compilation stage, while display driver compiler, preprocessor, compiler version of
gcc -nostdinc -I dir hello.c -o hello # not in the standard system 'directories for header files. Search only `-I' option specifies the directory (and the current directory)
Build the static link library
gcc -c hello.o Mr. hello.c -o # into object files .o
Ar CRV hello.a hello.o # packaged as a static link library file .a of
gcc cxd.c -o cxd -L / root / desktop / hello.a # invoked own static link library
Compiled dynamic link library
gcc -fPIC -c hello.c # compiled into location-independent .o files
gcc -shared hello.o -o hello.so # generate dynamic link library
/root/desktop/hello.so gcc cxd.c -o cxd -L # call your own dynamic-link library
GDB debugger
Note 1: The need to debug a program at compile time to add the -g option, the program can be debugged
Note 2: All of the following commands can be abbreviated first letter, for example: info break ==> ib except in special statement
#gdb program // enter debug mode
#list file.c: fanction // display function file.c file fanction
#break file.c: fanction // fanction function at file.c file hit a breakpoint
#break file.c: 100 // 100 line in file.c file hit a breakpoint
#info break / / view all breakpoints
#delete break num // remove the breakpoint number to num breakpoint
#run // start the program
#bt // display the program stack
#watch expr // surveillance expr variables (variables to each run it will print the value of the variable) (watch can not be abbreviated)
#Print value expr variable print at expr //, (currently running variable in the function)
#C // continue the program
#next // single-step operation
#quit / / exit debugging