[H-GEN] 'pow' wont work for me

The Fuzzy One s335810 at student.uq.edu.au
Mon Jul 6 01:58:59 EDT 1998


On Mon, 6 Jul 1998, Luke Grant wrote:

> In function 'main';
> /home/clientcgi/testpow.c : : undefined reference to 'pow'
> make: *** [encode] Error1

bash-2.02$ gcc -o testpow testpow.c -lm
bash-2.02$ ./testpow 
Inf
bash-2.02$ _

There doesn't seem to be anything wrong with the source code.  When
compiling with maths functions, make sure you use -lm to actually link in
the library... but that should give an error more like:

bash-2.02$ gcc -o testpow testpow.c 
Undefined                       first referenced
 symbol                             in file
pow                                 /var/tmp/cca000JP1.o
ld: fatal: Symbol referencing errors. No output written to testpow
bash-2.02$ _

As to your error, I'd be checking the actual header file which is being
included, ie /usr/include/math.h.

Try gcc -E testpow.c | less, to see exactly what's being included.

(what?  I'm the first one in on -C- question??)

        fuzzy BSc.

                                //////      //////    ///  ///
         ////////   // //    ////   ///  ////   ///  ///  ///
                            ///    ///  ///    ///  ///  ///
       // // //  ////////  ///    ///  ///    ///  ///  ///
                          ///    ///  ///    ///  ///  ///
      
     <A href="http://student.uq.edu.au/~s335810">www</A>
    <A href="mailto:s335810 at student.uq.edu.au">mail</A>







More information about the General mailing list