hello I need to make such a move: 2 ^ 5, so, I write pow (2,5) and I get this error: "[Linker error] undefined reference to `pow' ". why? I tried other compilers and all was ok, but on mspgcc I dont work. All paths are ok, ie when i write pow (2), then compiler says: "too few arguments to function `pow' ", so I can say then, that compiler had found math.h, coz he know what a function it is, but why it dont work pow (2,5) ??? in my math.h it is: #ifndef _REENT_ONLY #ifndef __math_6881 extern double acos _PARAMS((double)); extern double asin _PARAMS((double)); extern double atan2 _PARAMS((double, double)); extern double cosh _PARAMS((double)); extern double sinh _PARAMS((double)); extern double exp _PARAMS((double)); extern double ldexp _PARAMS((double, int)); extern double log _PARAMS((double)); extern double log10 _PARAMS((double)); extern double pow _PARAMS((double, double)); extern double sqrt _PARAMS((double)); extern double fmod _PARAMS((double, double)); #endif /* ! defined (__math_68881) */ #endif /* ! defined (_REENT_ONLY) */ Now I have my own pow function, but its very important to me, coz I'll need soon sqrt and tan functions but all has the same syntax. anyone...help me!
BIG problems with math.h
Started by ●May 11, 2005
Reply by ●May 11, 20052005-05-11
Why would I not be serious? I had to supply my own implementation when
I wanted to benchmark that compiler. Things might have changed, but
last time I looked I couldn't find a canned libm to link against.
Regards,
-- Paul.
> -----Original Message-----
> From: Frederic Beaulieu [mailto:fbeaulieu@fbea...]
> Sent: 11 May 2005 12:37
> To: msp430@msp4...
> Subject: RE: [msp430] BIG problems with math.h
>
> Are you serious when you say something like this!
>
> -----Original Message-----
> From: msp430@msp4... [mailto:msp430@msp4...]
> On Behalf Of Paul Curtis
> Sent: Wednesday, May 11, 2005 8:22 AM
> To: msp430@msp4...
> Subject: RE: [msp430] BIG problems with math.h
>
> Perhaps libm isn't available for MSPGCC?
>
> -- Paul.
>
> > -----Original Message-----
> > From: HEX.loader [mailto:hexloader@hexl...]
> > Sent: 11 May 2005 12:23
> > To: msp430@msp4...
> > Subject: [msp430] BIG problems with math.h
> >
> > hello
> >
> > I need to make such a move: 2 ^ 5, so, I write pow (2,5) and I get
> > this error: "[Linker error] undefined reference to `pow'
".
> > why?
> > I tried other compilers and all was ok, but on mspgcc I dont work.
> > All paths are ok, ie when i write pow (2), then compiler says:
> > "too few arguments to function `pow' ", so I can say
then, that
> > compiler had found math.h, coz he know what a function it
> is, but why
> > it dont work pow (2,5) ???
> > in my math.h it is:
> >
> > #ifndef _REENT_ONLY
> > #ifndef __math_6881
> > extern double acos _PARAMS((double));
> > extern double asin _PARAMS((double));
> > extern double atan2 _PARAMS((double, double)); extern double cosh
> > _PARAMS((double)); extern double sinh _PARAMS((double));
> extern double
> > exp _PARAMS((double)); extern double ldexp _PARAMS((double, int));
> > extern double log _PARAMS((double)); extern double log10
> > _PARAMS((double)); extern double pow _PARAMS((double,
> double)); extern
> > double sqrt _PARAMS((double)); extern double fmod _PARAMS((double,
> > double)); #endif /* ! defined (__math_68881) */ #endif /* !
> > defined (_REENT_ONLY) */
> >
> > Now I have my own pow function, but its very important to
> me, coz I'll
> > need soon sqrt and tan functions but all has the same syntax.
> >
> > anyone...help me!
> >
> >
> > .
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> >
>
>
> .
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.11.8 - Release Date: 5/10/2005
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.11.8 - Release Date: 5/10/2005
>
>
>
>
> .
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
Reply by ●May 11, 20052005-05-11
You are still at the wrong place to ask this question! To do 2^5, you don't need the pow function, only to write "2>>5" ... To have acces to math.h, you just need to add the -lm option in your compilation option. Fred ------------------------------- Frederic Beaulieu, M.Sc. Research and Development NewTrax Technologies Inc. http://www.newtraxtech.com/ -----Original Message----- From: msp430@msp4... [mailto:msp430@msp4...] On Behalf Of HEX.loader Sent: Wednesday, May 11, 2005 8:23 AM To: msp430@msp4... Subject: [msp430] BIG problems with math.h hello I need to make such a move: 2 ^ 5, so, I write pow (2,5) and I get this error: "[Linker error] undefined reference to `pow' ". why? I tried other compilers and all was ok, but on mspgcc I dont work. All paths are ok, ie when i write pow (2), then compiler says: "too few arguments to function `pow' ", so I can say then, that compiler had found math.h, coz he know what a function it is, but why it dont work pow (2,5) ??? in my math.h it is: #ifndef _REENT_ONLY #ifndef __math_6881 extern double acos _PARAMS((double)); extern double asin _PARAMS((double)); extern double atan2 _PARAMS((double, double)); extern double cosh _PARAMS((double)); extern double sinh _PARAMS((double)); extern double exp _PARAMS((double)); extern double ldexp _PARAMS((double, int)); extern double log _PARAMS((double)); extern double log10 _PARAMS((double)); extern double pow _PARAMS((double, double)); extern double sqrt _PARAMS((double)); extern double fmod _PARAMS((double, double)); #endif /* ! defined (__math_68881) */ #endif /* ! defined (_REENT_ONLY) */ Now I have my own pow function, but its very important to me, coz I'll need soon sqrt and tan functions but all has the same syntax. anyone...help me! . Yahoo! Groups Links -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.11.8 - Release Date: 5/10/2005 -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.11.8 - Release Date: 5/10/2005
Reply by ●May 11, 20052005-05-11
Fred, > -----Original Message----- > From: Frederic Beaulieu [mailto:fbeaulieu@fbea...] > Sent: 11 May 2005 12:33 > To: msp430@msp4... > Subject: RE: [msp430] BIG problems with math.h > > You are still at the wrong place to ask this question! > To do 2^5, you don't need the pow function, only to write "2>>5" ... > To have acces to math.h, you just need to add the -lm option > in your compilation option. Ahh, 2>>5 == 0. That's not right. Umm, 2 << 5 = 2*2^5 = 2^6 = 64. That's not right either. But, 2^5 == 32 == 1 << 5. That is right. :-) Regards, -- Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk CrossWorks for MSP430, ARM, AVR and (soon) MAXQ processors
Reply by ●May 11, 20052005-05-11
Hi, > but its funny, its simple mathematical move, why it cant be available? > and if its so, why then in mspgcc include dir I have math.h > with all its functions, macros and so on, what for, if its > unavailable? > and it cannot be true, coz I dont believe that mspgcc dont > support sqrt, tan and other mathematical operands. > > ehhh... I need these functions so much. Time to port an implementation of libm, then? fdlibm is generally available. Note that pow() and sqrt() are functions that take doubles. If you need single precision floating point, you should be using the powf() and sqrtf() functions. Regards, -- Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk CrossWorks for MSP430, ARM, AVR and (soon) MAXQ processors
Reply by ●May 11, 20052005-05-11
Are you serious when you say something like this!
-----Original Message-----
From: msp430@msp4... [mailto:msp430@msp4...] On Behalf
Of Paul Curtis
Sent: Wednesday, May 11, 2005 8:22 AM
To: msp430@msp4...
Subject: RE: [msp430] BIG problems with math.h
Perhaps libm isn't available for MSPGCC?
-- Paul.
> -----Original Message-----
> From: HEX.loader [mailto:hexloader@hexl...]
> Sent: 11 May 2005 12:23
> To: msp430@msp4...
> Subject: [msp430] BIG problems with math.h
>
> hello
>
> I need to make such a move: 2 ^ 5, so, I write pow (2,5) and
> I get this error: "[Linker error] undefined reference to `pow'
".
> why?
> I tried other compilers and all was ok, but on mspgcc I dont work.
> All paths are ok, ie when i write pow (2), then compiler says:
> "too few arguments to function `pow' ", so I can say then,
> that compiler had found math.h, coz he know what a function
> it is, but why it dont work pow (2,5) ???
> in my math.h it is:
>
> #ifndef _REENT_ONLY
> #ifndef __math_6881
> extern double acos _PARAMS((double));
> extern double asin _PARAMS((double));
> extern double atan2 _PARAMS((double, double)); extern double
> cosh _PARAMS((double)); extern double sinh _PARAMS((double));
> extern double exp _PARAMS((double)); extern double ldexp
> _PARAMS((double, int)); extern double log _PARAMS((double));
> extern double log10 _PARAMS((double)); extern double pow
> _PARAMS((double, double)); extern double sqrt
> _PARAMS((double)); extern double fmod _PARAMS((double,
> double)); #endif /* ! defined (__math_68881) */ #endif /* !
> defined (_REENT_ONLY) */
>
> Now I have my own pow function, but its very important to me,
> coz I'll need soon sqrt and tan functions but all has the same syntax.
>
> anyone...help me!
>
>
> .
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
.
Yahoo! Groups Links
--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.8 - Release Date: 5/10/2005
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.8 - Release Date: 5/10/2005
Reply by ●May 11, 20052005-05-11
On 5/11/05, Paul Curtis <plc@plc@...> wrote:
> Perhaps libm isn't available for MSPGCC?
>
but its funny, its simple mathematical move, why it cant be available?
and if its so, why then in mspgcc include dir I have math.h with all
its functions, macros and so on, what for, if its unavailable?
and it cannot be true, coz I dont believe that mspgcc dont support
sqrt, tan and other mathematical operands.
ehhh... I need these functions so much.
Reply by ●May 11, 20052005-05-11
----- Original Message ----- From: "HEX.loader" <hexloader@hexl...> To: <msp430@msp4...> Sent: Wednesday, May 11, 2005 1:22 PM Subject: [msp430] BIG problems with math.h > hello > > I need to make such a move: 2 ^ 5, so, I write pow (2,5) and > I get this error: "[Linker error] undefined reference to `pow' ". > why? Have you got '-lm' at the end of your command line? libm.a won't get linked otherwise. Leon -- Leon Heller http://webspace.webring.com/people/jl/leon_heller/
Reply by ●May 11, 20052005-05-11
You're right! I never pay attention these details. Sorry Hex ------------------------------- Frederic Beaulieu, M.Sc. Research and Development NewTrax Technologies Inc. http://www.newtraxtech.com/ -----Original Message----- From: msp430@msp4... [mailto:msp430@msp4...] On Behalf Of Paul Curtis Sent: Wednesday, May 11, 2005 8:33 AM To: msp430@msp4... Subject: RE: [msp430] BIG problems with math.h Fred, > -----Original Message----- > From: Frederic Beaulieu [mailto:fbeaulieu@fbea...] > Sent: 11 May 2005 12:33 > To: msp430@msp4... > Subject: RE: [msp430] BIG problems with math.h > > You are still at the wrong place to ask this question! > To do 2^5, you don't need the pow function, only to write "2>>5" ... > To have acces to math.h, you just need to add the -lm option > in your compilation option. Ahh, 2>>5 == 0. That's not right. Umm, 2 << 5 = 2*2^5 = 2^6 = 64. That's not right either. But, 2^5 == 32 == 1 << 5. That is right. :-) Regards, -- Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk CrossWorks for MSP430, ARM, AVR and (soon) MAXQ processors . Yahoo! Groups Links -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.11.8 - Release Date: 5/10/2005 -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.11.8 - Release Date: 5/10/2005
Reply by ●May 11, 20052005-05-11
Looks like in the latest mspgcc distribution you can get something linked like this: msp430-gcc foo.c -Wl,-mmsp430x1611 -lm -lfp So, if foo.c uses sin() then it all gets linked up hunkey dorey. If, however, you need 64-bit doubles for sin() then it looks like you're out of luck. Regards, -- Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk CrossWorks for MSP430, ARM, AVR and (soon) MAXQ processors > -----Original Message----- > From: HEX.loader [mailto:hexloader@hexl...] > Sent: 11 May 2005 12:23 > To: msp430@msp4... > Subject: [msp430] BIG problems with math.h > > hello > > I need to make such a move: 2 ^ 5, so, I write pow (2,5) and > I get this error: "[Linker error] undefined reference to `pow' ". > why? > I tried other compilers and all was ok, but on mspgcc I dont work. > All paths are ok, ie when i write pow (2), then compiler says: > "too few arguments to function `pow' ", so I can say then, > that compiler had found math.h, coz he know what a function > it is, but why it dont work pow (2,5) ??? > in my math.h it is: > > #ifndef _REENT_ONLY > #ifndef __math_6881 > extern double acos _PARAMS((double)); > extern double asin _PARAMS((double)); > extern double atan2 _PARAMS((double, double)); extern double > cosh _PARAMS((double)); extern double sinh _PARAMS((double)); > extern double exp _PARAMS((double)); extern double ldexp > _PARAMS((double, int)); extern double log _PARAMS((double)); > extern double log10 _PARAMS((double)); extern double pow > _PARAMS((double, double)); extern double sqrt > _PARAMS((double)); extern double fmod _PARAMS((double, > double)); #endif /* ! defined (__math_68881) */ #endif /* ! > defined (_REENT_ONLY) */ > > Now I have my own pow function, but its very important to me, > coz I'll need soon sqrt and tan functions but all has the same syntax. > > anyone...help me! > > > . > > > Yahoo! Groups Links > > > > > > > >