Hi, Yeah, -lm is already included. I delete the explicit inclusion of "math.h" and use powf; it works. Thanks for your help.
-Xiaohui On Sat, Jun 13, 2009 at 9:35 AM, Michael Schippling <[email protected]>wrote: > If you are using the telos motes then that is probably > the right math.h file. I thought -lm was already part > of the TOS compile, but maybe not -- it's the standard > compile option to include the math library. If it fixes > your problem it fixes your problem....I would look > in the file and see if there are different funtions > for floats, but it might be just the atmega that needs it > > MS > > Xiaohui Liu wrote: > >> The only "math.h" I can find in my system is under >> "/opt/msp430/msp430/include". Even I explicitly include it in my program, I >> still encounter the same error. From the old archive, this problem seems to >> be solved by "using '-lm' compiler switch" in the Makefile. Any idea on >> this? >> >> -Xiaohui >> >> On Fri, Jun 12, 2009 at 11:18 AM, Michael Schippling >> <[email protected]<mailto: >> [email protected]>> wrote: >> >> pow() probably operates on doubles. I imagine that there is a >> float version for the motes, maybe powf(). Look at the math.h >> header for your platform, in the include directories for the >> specific compiler you are using. >> >> MS >> >> Xiaohui Liu wrote: >> >> Hi everyone, >> >> I intend to compute power of x to y, whose type is float. It >> works well with TOSSIM by using pow function. Unfortunately, >> when I compile in telosb, it complaints "app.c:(.text+0x4486): >> undefined reference to `pow'". And I find in the archive >> <http://www.nabble.com/Regarding-pow-and-sqrt-td18204383.html> >> that this could be solved by "using '-lm' compiler switch". How >> could I actually do that to tell the compiler to link against >> math library? Thanks. >> >> >> -Xiaohui >> >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Tinyos-help mailing list >> [email protected] >> <mailto:[email protected]> >> >> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help >> >> >>
_______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
