2008/4/15, John Salmon <[EMAIL PROTECTED]>:
> I'm running Debian Etch on a PC. When I try to compile the following
>  (called test.c);
>
>  #include <math.h>
>  #include <stdio.h>
>
>  int main()
>  {
>     double
>         val = 1.55;
>
>     printf("sine: %g\n", sin(val));
>
>     return 0;
>  }
>
>  using the command line
>
>  gcc -Wall -o test test.c
>
>  I get
>
>  /tmp/cciDV02m.o: In function `main':
>  test.c:(.text+0x21): undefined reference to `sin'
>  collect2: ld returned 1 exit status
>
>  When I compile the equivalent C++ program using the apropriate C++
>  parameters, everything goes great. Have I neglected to load a Debian
>  package? Any help will be appreciated.

Use the -lm flag

Regards,
Sergio Cuellar

-- 
"Meine Hoffnung soll mich leiten
Durch die Tage ohne Dich
Und die Liebe soll mich tragen
Wenn der Schmerz die Hoffnung bricht"


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to