Menu

#1 functions/spuc_math.cpp compile errors

open
nobody
None
5
2002-01-11
2002-01-11
Gavin Voigt
No

Below is a list of errors when compiling spuc_math.cpp
and fixed code. I have not determined the cause of the
last error. Compiled using Cygwin cygwin-1.1.7-1.

Could you detemine the cause the remaining error?

Regards
Gavin

-----------------
Code fix:
// function for hyperbolic cosine of x
double cosh(double x) { return((exp(x)+exp(-x))/2.); }

-----------------
Compiler error messages:

$ make
g++ -Wno-non-template-friend -
c ../functions/spuc_math.cpp -I../functions -
I../generic -I../specializations
../functions/spuc_math.cpp: In function `double
SPUC::cosh(double)':
../functions/spuc_math.cpp:27: parse error before `)'
make: *** [spuc_math.o] Error 1

$ make
g++ -Wno-non-template-friend -
c ../functions/spuc_math.cpp -I../functions -
I../generic -I../specializations
../functions/spuc_math.cpp: In function `double
SPUC::cosh(double)':
../functions/spuc_math.cpp:27: `class
SPUC::complex<double>' used where a floating point
value was expected
../functions/spuc_math.cpp:27: aggregate value used
where a float was expected
make: *** [spuc_math.o] Error 1

$ make
g++ -Wno-non-template-friend -
c ../functions/spuc_math.cpp -I../functions -
I../generic -I../specializations
../functions/spuc_math.cpp: In function `double
SPUC::cosh(double)':
../functions/spuc_math.cpp:27: `class
SPUC::complex<double>' used where a floating point
value was expected
../functions/spuc_math.cpp:27: aggregate value used
where a float was expected
make: *** [spuc_math.o] Error 1

Discussion

  • Olivier Lebaillif

    Logged In: YES
    user_id=63027

    Same problem here, here is the message:
    make
    g++ -Wno-non-template-friend -c ../functions/spuc_math.cpp
    -I../functions -I../generic -I../specializations
    ../functions/spuc_math.cpp: In function `double SPUC::cosh
    (double)':
    ../functions/spuc_math.cpp:27: cannot convert
    `SPUC::complex<double>'
    to `double' in return

    I did not try compiling with the version gcc 2.952. I am
    currently using 2.96-99. Looking at the files in CVS (qpsk
    directory) the latest update is about 4 months old and with
    the problems I am seeing I wonder if the project is still alive?

     
  • Olivier Lebaillif

    Logged In: YES
    user_id=63027

    Same problem here, here is the message:
    make
    g++ -Wno-non-template-friend -c ../functions/spuc_math.cpp
    -I../functions -I../generic -I../specializations
    ../functions/spuc_math.cpp: In function `double SPUC::cosh
    (double)':
    ../functions/spuc_math.cpp:27: cannot convert
    `SPUC::complex<double>'
    to `double' in return

    I did not try compiling with the version gcc 2.952. I am
    currently using 2.96-99. Looking at the files in CVS (qpsk
    directory) the latest update is about 4 months old and with
    the problems I am seeing I wonder if the project is still alive?

     
  • Kin Wong

    Kin Wong - 2002-01-30

    Logged In: YES
    user_id=443709

    You can fix this by prepending namespace std to exp().
    i.e.
    double cosh(double x) {
    return ( (std::exp(x)+std::exp(-x) )/2. );
    }

     
  • Kin Wong

    Kin Wong - 2002-01-30

    Logged In: YES
    user_id=443709

    You can fix this by prepending namespace std to exp().
    i.e.
    double cosh(double x) {
    return ( (std::exp(x)+std::exp(-x) )/2. );
    }

     

Log in to post a comment.

MongoDB Logo MongoDB