gcc with math library

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



To GCC-GNU support team,

please help me with the following problem:

I installed gcc 3.4.1 in my linux PC directly through Mandrake version 10.1.
(I just klicked twice in the gcc package program and did not configure by myself).

I can compile several programs, but I can not use math libraries.
Even with simple programs like:

/* * Simple test program -- simplified version of sample test hello.
    */
   #include <stdlib.h>
   #include <stdio.h>
   #include <math.h>

   int main(void)
   {
   double f;

   f = sin(0.1) ;
   printf( "Hello World \n" );
   printf( " %f \n", f);
   return 0;
   }

When I try to compile with gcc -otest test.c it caused the following error message:

/home/raphael/tmp/ccUXVGLx.o(.text+0x2c): In function `main':
: undefined reference to `sin'
collect2: ld returned 1 exit status

Without the "sin" function, the program is compiled and works.
I imagine the compiler can not find the include files (<math.h>).
I tried to put them in the test.c directory with no success in compilation.
Is there any configuration problem? How to solve it?

Thank you,

Raphael


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux