cancel
Showing results for 
Search instead for 
Did you mean: 

Math Library

franco
Associate II
Posted on December 09, 2005 at 11:17

Math Library

4 REPLIES 4
franco
Associate II
Posted on December 08, 2005 at 15:10

Hi,

I would like to use math library,but I'm not able :(

This is my simple code;

#include ''modm.h''

#include ''math.h''

double acos(double x);

double test,x;

main()

{

test = acos(x);

}

I use Cosmic C compiler,but I get these errors;

...testmath.lkf:1 symbol _acos$L not defined (Debug\main.o )

...testmath.lkf:1 symbol _acos not defined (Debug\main.o )

What am I missing??

Thanx

casimirod
Associate II
Posted on December 08, 2005 at 17:45

I have never used the cosmic c compiler, but it looks like you forgot to link with the c library. Something akin to the ''-lm'' flag in gcc. Check the compiler settings for a method to link with the math library.

I hope that helps.

luca239955_st
Associate III
Posted on December 09, 2005 at 04:30

translating what dcas says into Cosmic specific syntax, if you look into your linker file, you will probably find that the first of the following two lines is missing:

''C:\Program Files\COSMIC\CXST7\Lib\libfsl.st7''

''C:\Program Files\COSMIC\CXST7\Lib\libm.st7''

Note that the name of the floating library depends on the memory model used (libfsl is for ''stack long'', check the manual for complete info on this subjet).

Regards,

Luca (Cosmic)

franco
Associate II
Posted on December 09, 2005 at 11:17

Thank you very much!!!! ;)

Now it works very fine!! :-] I missed to add float library in linker command line...