gcc -o sample sample.o -lm 시에 m의 의미는?

 

라이브러리파일을 찾기위한 하나의 INDEX 문자열이다.

 

#include <math.h> 는 헤더이고, 오브젝트는 libm.a입니다.

여기에서, lib와 .a사이에 문자열스트링을 가지고 LINK시에 파일을 참조해서 LINK합니다.

 

예를 들어 다음과 같은 함수의 프로토타입은 math.h에 선언되어져 있어서 compile시에 성공적으로 수행되지만,

실제 LINK에는 라이브러리 파일의 오브젝트를 참조하기때문에 헤더와 라이브러리 오브젝트는 분리되어 있습니다.

 

ㅡㅡㅡㅡㅡㅡㅡㅡsin함수의 프로토타입(math.h에 선언되어져 있습니다.)ㅡㅡㅡㅡㅡㅡ

double sin(double x); sine 계산

float sinf(float x); sine 계산

long double sinl(long double x); sine 계산 

 

입력 매개 변수 리스트 : x radian

반환 값 : sine 값

ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ

sin함수의 구현은 libm.a에 바이너리형태로 구현되어 있습니다.

(오브젝트파일 -> 아카이브파일로 묶여있음)

 

bash-3.1$

bash-3.1$ find ./ -name libm.*

find: `./Documents and Settings': Permission denied

./MinGW/lib/libm.a (반드시 LINK할 디렉토리는 Makefile PATH에 설정되어 있어야 합니다.

find: `./Program Files/Windows NT/\272\270\301\266\307\301\267\316\261\327\267\245': Permission denied

find: File system loop detected; `./ProgramData/Application Data' is part of the same file system loop as `./ProgramData'.

find: `./ProgramData/Desktop': Permission denied

find: `./ProgramData/Documents': Permission denied

find: `./ProgramData/Favorites': Permission denied

find: `./ProgramData/Microsoft/Diagnosis/SoftLanding': Permission denied

find: `./ProgramData/Microsoft/Diagnosis/SoftLandingStage': Permission denied

find: `./ProgramData/Microsoft/Windows/Start Menu/\307\301\267\316\261\327\267\245': Permission denied

find: `./ProgramData/Start Menu': Permission denied

find: `./ProgramData/Templates': Permission denied

find: `./ProgramData/\271\331\305\301 \310\255\270\351': Permission denied

find: `./ProgramData/\275\303\300\333 \270\336\264\272': Permission denied

find: `./System Volume Information': Permission denied

find: File system loop detected; `./Users/All Users/Application Data' is part of the same file system loop as `./Users/All Users'.

find: `./Users/All Users/Desktop': Permission denied

find: `./Users/All Users/Documents': Permission denied

find: `./Users/All Users/Favorites': Permission denied

find: `./Users/All Users/Microsoft/Diagnosis/SoftLanding': Permission denied

find: `./Users/All Users/Microsoft/Diagnosis/SoftLandingStage': Permission denied

find: `./Users/All Users/Microsoft/Windows/Start Menu/\307\301\267\316\261\327\267\245': Permission denied

find: `./Users/All Users/Start Menu': Permission denied

find: `./Users/All Users/Templates': Permission denied

find: `./Users/All Users/\271\331\305\301 \310\255\270\351': Permission denied

find: `./Users/All Users/\275\303\300\333 \270\336\264\272': Permission denied

find: File system loop detected; `./Users/Default/AppData/Local/Application Data' is part of the same file system loop as `./Users/Default/AppData/Local'.

find: `./Users/Default/AppData/Local/History': Permission denied

find: `./Users/Default/AppData/Local/Temporary Internet Files': Permission denied

find: `./Users/Default/AppData/Roaming/Microsoft/Windows/Start Menu/\307\301\267\316\261\327\267\245': Permission denied

find: `./Users/Default/Application Data': Permission denied

find: `./Users/Default/Cookies': Permission denied

find: `./Users/Default/Documents/My Music': Permission denied

find: `./Users/Default/Documents/My Pictures': Permission denied

find: `./Users/Default/Documents/My Videos': Permission denied

find: `./Users/Default/Local Settings': Permission denied

find: `./Users/Default/My Documents': Permission denied

find: `./Users/Default/NetHood': Permission denied

find: `./Users/Default/PrintHood': Permission denied

find: `./Users/Default/Recent': Permission denied

find: `./Users/Default/SendTo': Permission denied

find: `./Users/Default/Start Menu': Permission denied

find: `./Users/Default/Templates': Permission denied

find: `./Users/Default/\275\303\300\333 \270\336\264\272': Permission denied

find: `./Users/Default User': Permission denied

find: `./Users/Public/Documents/My Music': Permission denied

find: `./Users/Public/Documents/My Pictures': Permission denied

find: `./Users/Public/Documents/My Videos': Permission denied

find: `./Windows/CSC/v2.0.6': Permission denied

+ Recent posts