[Q] sin (math.h) function error

Hi~


I wanna you to help me… ^^

I programmed very simple one program… like below…


#include <math.h>
#include <stdio.h>

void main()
{
fprintf(stderr, “Sin(%.5f)\n”, sin(3.14));
}

but, there was a compilation errror…

like this… "Undefined function…’_Sin()’ ‘sin’ ‘_LSin()’ "…


do I need to use more compilation options or anything…?

Plz, let me know how to slove this problem…

^^;;


Sincerely~


\

====================================================
Shin-Gang Kim
Research Engineer,
Information Technology Lab,
LG Electronics Institute of Technology
16 Woomyeon-Dong, Seocho-Gu, Seoul 137-724, Korea

Tel : +82-31-789-4233
Fax: +82-31-789-4206
E-mail: shingang@lge.com

“Shin-Gang Kim” <shingang@lge.com> wrote in message
news:ckgdtu$a0u$1@inn.qnx.com

Hi~


I wanna you to help me… ^^

I programmed very simple one program… like below…


#include <math.h
#include <stdio.h

void main()
{
fprintf(stderr, “Sin(%.5f)\n”, sin(3.14));
}

but, there was a compilation errror…

like this… "Undefined function…’_Sin()’ ‘sin’ ‘_LSin()’ "…

It’s not a compilation error, it’s a linker error. You need to add the math
library: -lm should do it.

do I need to use more compilation options or anything…?

Plz, let me know how to slove this problem…

^^;;


Sincerely~


\

====================================================
Shin-Gang Kim
Research Engineer,
Information Technology Lab,
LG Electronics Institute of Technology
16 Woomyeon-Dong, Seocho-Gu, Seoul 137-724, Korea

Tel : +82-31-789-4233
Fax: +82-31-789-4206
E-mail: > shingang@lge.com