Linux에서 c언어를 gcc로 컴파일할 때 수학 관련 함수들(sin, cos, sqrt 등)이 에러가 뜨며 실패할 때가 있다.
정확한 이유는 모르겠지만... linux에서의 gcc는 다른 OS들과 달리 math library(#include <math.h>)를 인지하지 못하나 보다.
그래서 command line에 -lm을 추가해야 정상대로 작동한다.
Reference)
http://stackoverflow.com/questions/10447791/what-does-lm-option-do-in-g
'Programming > C' 카테고리의 다른 글
Intel MKL 설정하기 (0) | 2016.11.28 |
---|---|
OS X에서 gcc로 Open MPI 설행하기 (0) | 2016.11.15 |
'for' loop initial declarations are only allowed in c99 mode use option -std=c99 (0) | 2016.11.09 |
OS X에서 OpenMP 실행하기 (0) | 2016.11.09 |
OS X에서 gnuplot 설치하기 (0) | 2016.11.08 |