3

我正在尝试使用 Borland 的 32 位编译器编译 MySql++。众所周知,此编译器在某些模板语法方面存在问题。编译器也几乎过时了,因为它正在被 clang 编译器所取代。

但是,如果可以将以下代码固定为可编译版本,则可以节省时间。

编译器错误发生在以下行:

template <> MYSQLPP_EXPORT bool String::conv(bool) const;

编译器错误是:

[bcc32 错误] mystring.h(726): E2506 'String::conv<Type>(Type) const' 的显式特化不明确:必须指定模板参数
完整的解析器上下文
transaction.cpp(32):#include lib\query .h
query.h(37): #include lib\result.h
result.h(40): #include lib\row.h
row.h(33): #include lib\mystring.h
mystring.h(46) : 命名空间 mysqlpp

String是自定义字符串类,conv()函数是类内的内联模板函数String

/// \brief Template for converting the column data to most any
/// numeric data type.
template <class Type>
Type conv(Type) const
{
    // Conversions are done using one of double/long/ulong/llong/ullong
    // so we call a helper function to do the work using that type.
    // This reduces the amount of template code instantiated.
    typedef typename detail::conv_promotion<Type>::type conv_type;
    return do_conv<conv_type>(typeid(Type).name());
}

我尝试了各种修改,但没有成功。

4

1 回答 1

0

这个答案是由 nathanoliver 给出的

 template <> MYSQLPP_EXPORT bool String::conv<bool>(bool) const;

这会使 bcc32 编译器静音...!

于 2016-09-28T22:24:18.913 回答