Skip to main content
franco
Associate III
Dec 9, 2005 10:17 AM UTC
Question

Math Library

Posted on December 09, 2005 at 11:17

Math Library

This topic has been closed for replies.

4 replies

franco
francoAuthor
Associate III
Dec 8, 2005 2:10 PM UTC
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
Dec 8, 2005 4:45 PM UTC
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 II
Dec 9, 2005 3:30 AM UTC
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
francoAuthor
Associate III
Dec 9, 2005 10:17 AM UTC
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...