相关的编译错误提振(compiling errors related boost)

2019-09-29 12:13发布

当我使用升压1.52.1和gcc-4.7.1编译我的代码,会出现以下错误。 看来这是提升和C ++库之间的冲突。 难道一些知道如何解决这个问题呢?

非常感谢您的回复。

c:\program files\mingw64\bin\../lib/gcc/x86_64-w64- 
mingw32/4.7.1/../../../../include/boost/math/policies
/error_handling.hpp: In function 'bool    boost::math::policies::
detail::check_overflow(std::complex<T>, 
R*, const char*, const Policy&)':c:\program    
files\mingw64\bin\../lib/gcc/x86_64-w64 mingw32/4.7.1
/../../../../include/boost/math/policies/error_handling.hpp:583:11: 
error: expected unqualified-id before numeric constant
c:\program files\mingw64\bin\../lib/gcc/x86_64-w64-mingw32
/4.7.1/../../../../include/boost/math/policies/error_handling.hpp:
584:49: error: lvalue required as unary '&' operand
 c:\program files\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.7.1/
 ../../../../include/boost/math/policies/
 error_handling.hpp:584:107: error: 'im' was not declared in this
 scope c:\program files\mingw64\bin\../lib/gcc/x86_64-w64-mingw32
 /4.7.1/../../../../include/boost/math/policies/error_handling.
 hpp: In function 'bool boost::math::policies::detail::
 check_underflow(std::complex<T>, R*, const char*, const Policy&)':
 c:\program files\mingw64\bin\../lib/gcc/x86_64-w64-  mingw32
 /4.7.1/../../../../include/boost/math/policies
 /error_handling.hpp:602:11: error: expected unqualified-id before       
 numeric constant c:\program files\mingw64\bin\../lib/gcc/
 x86_64-w64 mingw32/4.7.1/../../../../include/boost/math/policies
 /error_handling.hpp:603:50: error: lvalue required as 
 unary '&' operand c:\program files\mingw64\bin\../lib/gcc/
 x86_64-w64 mingw32/4.7.1/../../../../include/boost/math/policies
 /error_handling .hpp:603:109: error: 'im' was not declared in 
 this scope c:\program files\mingw64\bin\../lib/gcc
 /x86_64-w64-mingw32/4.7.1/../../../../include/boost/math/policies/
 error_handling.hpp: In function 'bool boost::math::policies::
 detail::check_denorm(std::complex<T>, R*, const char*, 
  const Policy&)':c:\program files\mingw64\bin\../lib/gcc
 /x86_64-w64-mingw32/4.7.1/../../../../include/boost/
 math/policies/error_handling.hpp:622:11: error: expected 
 unqualified-id before numeric constant
 c:\program files\mingw64\bin\../lib/gcc/x86_64-w64-
 mingw32/4.7.1/../../../../include/boost/math/policies/
 error_handling.hpp:623:47: error: lvalue required as 
 unary '&' operand
 c:\program files\mingw64\bin\../lib/gcc/x86_64-w64-
 mingw32/4.7.1/../../../../include/boost/math/policies/
 error_handling.hpp:623:103: error: 'im' was not declared
 in this scope

出现在代码升压\数学\政策\ error_handling.hpp错误。 但我不知道当程序引用这些功能。 这是如何发生的错误?

template <class R, class T, class Policy>
inline bool check_overflow(std::complex<T> val, R* result, const
char* function, const Policy& pol)
{
    typedef typename R::value_type r_type;
    r_type re, im;
    bool r = check_overflow<r_type>(val.real(), &re, function, pol) || check_overflow<r_type>(val.imag(), &im, function, pol);
    *result = R(re, im);
    return r;
}

 template <class R, class T, class Policy>
 inline bool check_underflow(std::complex<T> val, R* result, const char* function, const Policy& pol)
{
     typedef typename R::value_type r_type;
     r_type re, im;
     bool r = check_underflow<r_type>(val.real(), &re, function, pol) || check_underflow<r_type>(val.imag(), &im, function, pol);
     *result = R(re, im);
     return r;
}

Answer 1:

鉴于这种两个函数和此嘈杂错误消息我可以说,作为参数R不限定类型value_type 。 正因为如此,类型r_type和变量imre没有定义。 作为结果,你会得到error: 'im' was not declared in this scope的错误。

只使用提供的代码,我可以看到R型有这样的要求:

  • 它必须定义类型value_type
  • 它必须有构造R(value_type real, value_type imagine)

这一切都意味着你使用不正确地使用internaly check_underflow / check_overflow功能,不兼容的模板参数一些Boost库,我猜。



文章来源: compiling errors related boost