3.4.4 vs 3.2.5 ; fabs: cant use as a function..

corey taylor corey.taylor@gmail.com
Thu Jul 28 04:54:00 GMT 2005


Hi Fu,

  The code you attached doesn't show an include of cmath, but I assume
that you did try it.

  What happens when you explicitly call std::fabs ?

corey

On 7/27/05, Ming-Xiang Fu <deadly@cmlab.csie.ntu.edu.tw> wrote:
> 
> 
> hi, I am having some problem to compile a code by gcc 3.4.4 which is
> successfully compiled in gcc 3.2.5.
> 
> 
> At the begining, it complains about abs(float) is ambiguous..and sin(), cos()
> not declares.
> 
> And then, I include <cmath>, resolve some problem, and new problem occurs.
> 
> " ` fabs' cannot be used as a function "
> 
> 
> 
> please give me some guide, I will be appreciate about that.
> Thanks anyway. :)
> 
> 
>                                                                                                         RedMo
> part of src code as below.
> 
> ------------------------------------------------------------------------------------------------------------------------------------
> 
> // GlobalObject.cpp: implementation of the CGlobalObject class.
> //
> //////////////////////////////////////////////////////////////////////
> 
> #include "GlobalObject.h"
> #include <iomanip>
> #include <math.h>
> #include "../../Node/DEBUG.H"
> 
> using namespace std;
> 
> void VsMathObject::Evaluate(int member, VsValue& value, VsExprList &args,
> VsFunctionCall *parent)
> {
> 
>         switch(member)
>         {
> 
>         case fabs:
>                 value.SetNumber( fabs(arg0.GetNumber()) );
>                         // arg0.GetNumber() returns a float number.
>                 break;
>         case ffabs:
>                 value.SetNumber( fabs(arg0.GetNumber()) );
>                 break;
>         case facos:
>                 value.SetNumber( acos(arg0.GetNumber()) );
>                 break;
>         case fasin:
>                 value.SetNumber( asin(arg0.GetNumber()) );
>                 break;
> 
>         default:
>                 ASSERT(false);
>         }
> }
> 
> ---------------------------------------------------------------------------------------------------------------------------
> 
> 
> 
> 
> 
> --
> Communication and Multimedia Laboratory
> Dept. of Computer Science and Information Engineering, NTU
> 
> 
> 
>



More information about the Gcc-help mailing list