FreeFem/FreeFem-sources

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

zhf-0 opened this issue · 2 comments

zhf-0 commented

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:

  • OS:ubuntu 18.04 LTS
  • gcc: 7.5.0
  • g++: 7.5.0
  • mpi: mpich 4.1.2

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

Yes.

zhf-0 commented

Thank you very much for your reply.