Error message of compiling a C code

Hi,

Recently I have a C Code and i compile on my pc with

gcc -D _t_1 -o a.out test.c

It works fine for me on my pc. However, upon transferring the same code on Sun Solaris server, it breaks with the below message:-

Undefined first referenced
symbol in file
trunc /var/tmp//ccOdHYd0.o
ld: fatal: Symbol referencing errors. No output written to c.exe
collect2: ld returned 1 exit status

I am not so sure what causing the problem. Because I assume it shall work in all cases since it work on my pc. Can anyone point me any clue/hints to the above problem.

Thanks.Appreciate alot.

I forgot to mention that the trunc actually referring to below:-

double trunc(double);

typedef double Point;
#define rand_0_n(n) trunc((double)(drand48()*(n)))

Link the math lib "-lm" at compile time.

gcc -lm -D _t_1 -o a.out test.c

Hi Shamrock,

I did include -lm flag in my command.

gcc -D _t_1 -o a.out test.c -lm

I changed to (floor) but there is no output from ./a.out

Please advise. THanks.

Has the compile time error has gone after linking the math lib into the executable? Without looking at the code it is not possible to figure out what inputs are given to floor().