FreeFem / FreeFem-sources

FreeFEM source code
https://freefem.org/
Other
746 stars 187 forks source link

no match for ‘operator==’ (operand types are ‘const Cplx {aka const std::complex<double>}’ and ‘__complex__ double’) #286

Closed zhf-0 closed 1 year ago

zhf-0 commented 1 year ago

I try to install FreeFem following the tutorial, and when I execute

./reconfigure
make

to compile the programs, there are errors

./../../3rdparty/include/BemTool/bemtool/miscellaneous/htool_wrap.hpp:26:27: error: no match for ‘operator==’ (operand types are ‘const Cplx {aka const std::complex<double>}’ and ‘__complex__ double’)
     if( !( multiply_coeff == 1.0+1i*0.0) ){

and

./../../3rdparty/include/BemTool/bemtool/miscellaneous/htool_wrap.hpp:64:18: error: no match for ‘operator==’ (operand types are ‘const Cplx {aka const std::complex<double>}’ and ‘__complex__ double’)
     if( !( alpha == 1.0+1i*0.0) ){

The compile environments are:

I think the errors occur because the complex number 1.0+1i*0.0 can not be converted to std::complex type automatically, so I modify the file ./../../3rdparty/include/BemTool/bemtool/miscellaneous/htool_wrap.hpp

    if( !( multiply_coeff == std::complex<double> {1.0, 0.0}) ){

and

    if( !( alpha == std::complex<double> {1.0,0.0}) ){

Then the errors are gone, and everything is ok.

The question is: is the modification ok?

prj- commented 1 year ago

Yes.

zhf-0 commented 1 year ago

Thank you very much for your reply.