How can we see the list of available math library function in ubuntu?

Asked by Dharmesh Patadiya

I am using gcc compiler to compile the c program. the pow(x,y) library function is working in turbo compiler in windows base system. But in ubuntu pow(x,y) function is not working. How can we see the available c-math library function in ubuntu?

Patadiya Dharmesh M.

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu gcc-defaults Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Warren Hill (warren-hill) said :
#1

There are two things to consider here

First unlike most compilers on other systems the math library is not linked by default

you need to link in the math library add "-lm" to the compile instruction.

For example if you are trying to create a program called power and your source is made of one file "power.c"

gcc -o power -lm power.c

will work.

There are plenty of references on the Internet to the standard libraries

pow is defined indirectly in <math.h>

The main thing to bear in mind is that gcc is ANSI compatible and there are loads of references available both on the Internet any any good bookshop.

Revision history for this message
Warren Hill (warren-hill) said :
#2

Can you help with this problem?

Provide an answer of your own, or ask Dharmesh Patadiya for more information if necessary.

To post a message you must log in.