Vol wrote:
> Hi, group,
> When I compile my code, the error message are:
> "error C2668: 'fabs' : ambiguous call to overloaded function"
> "error C2668: 'sqrt' : ambiguous call to overloaded function"
>
> I already add the math library, what does this error mean? Thanks.
It probably means you are not compiling C code (or as C) since C does
not have overloaded functions.
If this is meant to be C post a *complete* small program exhibiting the
problem, if it is C++ then go to a group dealing in C++ such as
comp.lang.c++
Alternatively delete lines 4, 30, 43 to 1000 inclusive and 1002, destroy
all other copies of your program, and try again.
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it.

Vol wrote:
> Hi, group,
> When I compile my code, the error message are:
> "error C2668: 'fabs' : ambiguous call to overloaded function"
> "error C2668: 'sqrt' : ambiguous call to overloaded function"
>
> I already add the math library, what does this error mean? Thanks.
That you are not using a C compiler but probably a C++ compiler
to compile your code. So, your best bet is asking this question
in comp.lang.c++ as it is definitely off-topic and irrelevant
here.
<OT>You are probably passing an integer argument to functions which
are overloaded to have arguments of either type double, or type float
or type long double. This is a Bad Thing, as the compiler tries
to determine the best overloaded function -- and may use different
overloads at different places. This can result in irreproducible
behavior if the source code changes but slightly.
If you use literals, pass one of the right type, e.g.
2.0
2.0F
2.0L
instead of
2
For variables, use an appropriate static_cast<>() (not a C cast!!):
static_cast<double>(my_integer_argument)
</OT>
Cheers
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.

Michael Mair wrote:
> Vol wrote:
>
>> Hi, group,
>> When I compile my code, the error message are:
>> "error C2668: 'fabs' : ambiguous call to overloaded function"
>> "error C2668: 'sqrt' : ambiguous call to overloaded function"
>>
>> I already add the math library, what does this error mean? Thanks.
>
>
> That you are not using a C compiler but probably a C++ compiler
> to compile your code. So, your best bet is asking this question
> in comp.lang.c++ as it is definitely off-topic and irrelevant
> here.
>
> <OT>You are probably passing an integer argument to functions which
> are overloaded to have arguments of either type double, or type float
> or type long double. This is a Bad Thing, as the compiler tries
> to determine the best overloaded function -- and may use different
> overloads at different places. This can result in irreproducible
> behavior if the source code changes but slightly.
> If you use literals, pass one of the right type, e.g.
> 2.0
> 2.0F
> 2.0L
> instead of
> 2
> For variables, use an appropriate static_cast<>() (not a C cast!!):
> static_cast<double>(my_integer_argument)
> </OT>
This is the C++ solution.
If you wanted C: Use a C compiler!
>
>
> Cheers
> Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.