Trying to use pow() function... 
Author Message
 Trying to use pow() function...

   Writing a program, (first one on a unix platform for me), and trying to
use the pow() function.  When I try and compile the program, I get an
error.

/var/tmp/cc0038341.o: Undefined symbol `_pow' referenced from text segment

 Can anyone give me a pointer on how to fix this?
Thanks
Keith

KE4QOL



Tue, 10 Aug 1999 03:00:00 GMT  
 Trying to use pow() function...

Quote:
>    Writing a program, (first one on a unix platform for me), and trying to
> use the pow() function.  When I try and compile the program, I get an
> error.
>  Can anyone give me a pointer on how to fix this?

Link the math library in, e.g. via

        cc -o your_image <your-files> -lm
                                       ^^^
Jose
--
-------------
Karl-Jose Filler                Voice: +49-911-526-2870

D-90411 Nuernberg  Germany



Tue, 10 Aug 1999 03:00:00 GMT  
 Trying to use pow() function...

Hi,

Quote:
>   Writing a program, (first one on a unix platform for me), and trying to
>use the pow() function.  When I try and compile the program, I get an
>error.
>/var/tmp/cc0038341.o: Undefined symbol `_pow' referenced from text segment

using GCC/G++?

Quote:
> Can anyone give me a pointer on how to fix this?

Maybe you need to tell the compiler that the math lib should be linked with
your program. A "-lm" in the command line will probably fix the problem. This
undefined symbol stuff normally means the function was not found in the
program or the standard libs.

Quote:
>Thanks

Hope the advice was helpful...

Patrick



Tue, 10 Aug 1999 03:00:00 GMT  
 Trying to use pow() function...



Quote:
>   Writing a program, (first one on a unix platform for me), and trying to
>use the pow() function.  When I try and compile the program, I get an
>error.

>/var/tmp/cc0038341.o: Undefined symbol `_pow' referenced from text segment

This looks like a link error, not a compiler error.

Some C implementations on Unix have a bug that requires that you
explicitly include the math library in your link (even though its
part of the standard).



Tue, 10 Aug 1999 03:00:00 GMT  
 Trying to use pow() function...

...

Quote:
>Some C implementations on Unix have a bug that requires that you
>explicitly include the math library in your link (even though its
>part of the standard).

That isn't a bug however. The standard doesn't specify how a conforming
iplementation is invoked. Some compilers might require -ansi, other -Xc and
so on. If some require a compile or link option of -lm or similar that's
fine too.

--
-----------------------------------------


-----------------------------------------



Thu, 12 Aug 1999 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. using try function in c

2. computing powers without the pow() function.

3. POW FUNCTION

4. POW Function...Please Help

5. pow function

6. POW FUNCTION....PLEASE HELP

7. POW Function...Please Help

8. a pow function

9. the pow() function

10. help with the pow() function

11. Implementation of pow(3m) function

12. Question regarding pow() function

 

 
Powered by phpBB® Forum Software