Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to link to the math library from inside the C source code in gcc?

Tags:

c

include

unix

gcc

When I tried to include <math.h> I found that I need to link math library by using command gcc -lm

But I am searching for another way to link the math library 'in code', that does not require the user to compile using any options..

Can gcc -lm be done in C code using #pragma or something?

EDIT: I have changed -ml to -lm

like image 312
Betamoo Avatar asked May 17 '10 10:05

Betamoo


1 Answers

The usual way to simplify complication for the user (or indeed for the developer) is to write a makefile.

like image 111
Andrew McGregor Avatar answered Sep 23 '22 15:09

Andrew McGregor