Differences between revisions 2 and 3
Revision 2 as of 2005-08-17 16:34:24
Size: 1175
Editor: 203
Comment:
Revision 3 as of 2011-08-03 11:01:06
Size: 1175
Editor: localhost
Comment: converted to 1.6 markup
No differences found!

GnuCompilerCollection

[GNU] [Cee] / CeePlusPlus Compiler

http://gcc.gnu.org

각종자료


일반적인 사용법

$ gcc -g -Wall -ohello hello.c

옵션들

  • -o : 출력파일명을 정한다.
  • -c : 컴파일만한다. .o파일 생성
  • -I : 헤더파일위치 지정. 보통은 ""을 기준으로한다. -Iinclude 하면 현재 디렉토리의 include디렉토리
  • -l : 사용하는 라이브러리. libmylib.a 이면 -lmylib 이라고 쓴다.
  • -L : 라이브러리의 위치

라이브러리만드는법

 $ gcc -c myfunc.c
 $ ar r libmylib.a myfunc.o
 $ ar s libmylib.a
 $ ar t libmylib.a
 myfunc.o
 $ gcc -o say_linux hello.c -lmylib

64bit용으로 컴파일하기 옵션

CC=gcc CFLAGS="-O3 -m64 -fno-omit-frame-pointer" CXX=gcc 
CXXFLAGS="-O3 -m64 -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti"

[Debugging]은 주로 GDB 에서 한다.


SeeAlso GCC, CeeCompiler


CategoryProgram

GCC (last edited 2013-02-14 13:45:41 by 61)

web biohackers.net