C++ compiler problems with FC2
Robert L Cochran
cochranb at speakeasy.net
Tue Aug 31 01:04:06 UTC 2004
> Does this compile for you
>
> #include <iostream>
> #include <cmath>
>
> using namespace std;
>
> int main()
> {
> cout << "sine 63 = " << sin(63) << endl;
> cout << "log to the base 10 of 54 = " << log10(54) << endl;
> double quick = (sin(53) * sqrt(14.3443) + tanh(22)) / log(61.444);
> cout << "quick = " << quick << endl;
> }
>
> This should give you...
>
> sine 63 = 0.167356
> log to the base 10 of 54 = 1.80618
> quick = 0.606956
>
> Very silly test, but should work without a hitch.
>
> TTFN
>
> Paul
[rlc at bobcp4 cpp]$ g++ -Wall -pedantic -o tsine tsine.cpp
tsine.cpp: In function `int main()':
tsine.cpp:8: error: call of overloaded `sin(int)' is ambiguous
/usr/include/bits/mathcalls.h:66: error: candidates are: double
sin(double)
/usr/include/c++/3.3.3/cmath:522: error: long double
std::sin(long double)
/usr/include/c++/3.3.3/cmath:518: error: float
std::sin(float)
tsine.cpp:9: error: call of overloaded `log10(int)' is ambiguous
/usr/include/bits/mathcalls.h:113: error: candidates are: double
log10(double)
/usr/include/c++/3.3.3/cmath:437: error: long double
std::log10(long double)
/usr/include/c++/3.3.3/cmath:429: error: float
std::log10(float)
tsine.cpp:10: error: call of overloaded `sin(int)' is ambiguous
/usr/include/bits/mathcalls.h:66: error: candidates are: double
sin(double)
/usr/include/c++/3.3.3/cmath:522: error: long double
std::sin(long double)
/usr/include/c++/3.3.3/cmath:518: error: float
std::sin(float)
tsine.cpp:10: error: call of overloaded `tanh(int)' is ambiguous
/usr/include/bits/mathcalls.h:77: error: candidates are: double
tanh(double)
/usr/include/c++/3.3.3/cmath:582: error: long double
std::tanh(long double)
/usr/include/c++/3.3.3/cmath:574: error: float
std::tanh(float)
[rlc at bobcp4 cpp]$ rpm -q gcc
gcc-3.3.3-7
[rlc at bobcp4 cpp]$
More information about the test
mailing list