카테고리 없음
gcc에서 math library 로드하는 방법
사도요한
2014. 4. 22. 23:34
만약 c 코드 안에 math library(math.h)를 사용하고서 gcc에서 바로 컴파일하면 undefined reference 오류가 난다.
math library를 로드하려면, -lm 옵션을 붙여서 사용할 것.
예를 들어, filename.c를 컴파일 할 때,
gcc -lm -o filename filename.c
이같이 하면 됨.