使用vs2015编译器编译libpqxx时发生的错误以及解决办法

d:libpqxx-4.0libpqxx-4.0srcstrconv.cxx(195): error C2440: “=”: 无法从“std
::basic_istream<char,std::char_traits<char>>”转换为“bool”
d:libpqxx-4.0libpqxx-4.0srcstrconv.cxx(195): note: 没有可用于执行该转换的用
户定义的转换运算符,或者无法调用该运算符
d:libpqxx-4.0libpqxx-4.0srcstrconv.cxx(468): note: 参见对正在编译的函数 模板
实例化“void `anonymous-namespace'::from_string_float<float>(const char [],T &)
”的引用
with
[
T=float
]
NMAKE : fatal error U1077: “"D:Program Files (x86)Microsoft Visual Studio 14.
0VCBINcl.exe"”: 返回代码“0x2”
Stop.

以上错误主要是在strconv.cxx中195行所在的函数,ok赋值时没有从char类型转为bool类型,因此增加一次强转就可以了。

  default:
    if (Str[0] == '-' && valid_infinity_string(&Str[1]))
    {
      ok = true;
      set_to_Inf(result, -1);
    }
    else
    {
      stringstream S(Str);
#if defined(PQXX_HAVE_IMBUE)
      S.imbue(locale("C"));
#endif
      ok =(bool) (S >> result);
    }
    break;
  }
原文地址:https://www.cnblogs.com/zhangdewang/p/9704969.html