Size: 1282
Comment:
|
← Revision 6 as of 2013-02-14 13:45:41 ⇥
Size: 1466
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 11: | Line 11: |
* [[http://www.gentoo.org/proj/en/base/amd64/howtos/index.xml?part=1&chap=3|HOWTO fix -fPIC errors]] | |
Line 13: | Line 12: |
---- 일반적인 사용법 |
== 일반적인 사용법 == |
Line 43: | Line 43: |
== 64bit 컴파일 오류시 대처 == 1. CFLAGS에 -fPIC를 넣어줘야 하는 경우가 있다. 참고 [[http://www.gentoo.org/proj/en/base/amd64/howtos/index.xml?part=1&chap=3|HOWTO fix -fPIC errors]] 1. 32bit 용 라이브러리들이 PATH상 먼저 있는지 확인 |
각종자료
In KLDP
일반적인 사용법
$ 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"
64bit 컴파일 오류시 대처
CFLAGS에 -fPIC를 넣어줘야 하는 경우가 있다. 참고 HOWTO fix -fPIC errors
- 32bit 용 라이브러리들이 PATH상 먼저 있는지 확인