2011年5月19日 星期四

GCC Using command

gcc is a GNU project compiler, and you can see it on many Unix like system.

I'll note some using way.

#gcc -O foo.c -o bar.out
#./bar.out

Compile a C program file to a execution file.

-O -> Optimization parameter

-O3 -O2 -O1 -O0    -> 0 do not optimize, 3 is best optimization.


#gcc -Wall -g foo.c -o bar.out

-Wall  -> displayed the warning message  
-g  -> Using gdb debugging and show error message

#gcc -I/usr/include -L/usr/lib -lm test.c -o test 

-Idir_name -> find the header file in directory
-Ldir_name -> find the linrary file in directory
-llibfile_name -> join a library file "libm.so" overpass lib & .so


0 意見:

張貼留言

 
創用 CC 授權條款