This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: gcc problem.


mohamed farid wrote:
> 
> Dear all,
>           I have a problem while compiling a C file using gcc. The
> problem arise when i try to include <math.h> and use any of it's
> functions as "pow". The compiler gives the following error "undefined
> reference to `pow`         ld returned 1 exit status "
> I have configured all the pathes the LD_LIBRARY_PATH and the INCLUDEDIR
> Please help me solving this problem
> 

You need to link with the math library as well.  For example,

gcc -o foo foo.c -lm

-eric

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]