Linux 컴파일 과정

Tips/Linux 2013. 10. 29. 13:01

[Object File]

$ gcc -c test.cpp

-> test.o 생성

[Execution File]

$ gcc -o main main.o test1.o test2.o -lsvm -I./ -ltest -L./

-> main.o, test1.o, test2.o를 묶어 실행파일 main 생성

-> -l : library file name (ex: -lsvm -lopencv_core)    ==> 파일 하나씩 따로 지정

-> -I : Include path (ex: -I"./" -I"openCV/include")    ==> 폴더 하나씩 따로 지정

-> -L : (user defined) library path (ex: -L"lib/libsvm" -L"lib/openCV")    ==> 폴더 하나씩 따로 지정

 

[Stationary Library (.a) File]

$ ar cr libtest.a test1.o test2.o

-> test1.o, test2.o를 묶어 (archive) libtest.a라는 정적 라이브러리 생성

(정적 라이브러리명: lib-으로 시작하고 .a로 끝)

'Tips > Linux' 카테고리의 다른 글

[LINUX] 쉘 프롬프트에 IP 보이기  (0) 2015.11.09
[Linux] 주기적으로 명령어 실행  (0) 2015.05.18
[Linux] standard error 파일 저장 및 화면 출력을 한번에  (0) 2015.05.18
[Linux] .vimrc 설정  (0) 2014.12.01
vim 명령어  (0) 2013.12.12