您的位置:首页 > 其它

tinybind学习一

2015-12-23 14:48 351 查看

tinybind 简介

add-on library for the cross-platform XML parser tinyxml that makes it easy to "bind" a C++ struct definition to an XML file format for easy serialize/deserialize. supports nested structs and STL containers.

源码地址

tinybind 编译

由于tinybind好多年没人维护了,编译时出现了多出错误。

在linux下编译时,出现了以下错误:

1、tinybind/tinybind.h:222: error: there are no arguments to 'params' that depend on a template parameter, so a declaration of 'params' must be available [-fpermissive]

错误原因查看:参考文档

解决方法:在 IMemberHolder<T>的报错子类中添加:

using IMemberHolder<T>::tag;

using IMemberHolder<T>::params;

2、tinybind/tinytest.cpp:27: error: specializing member '::GetTiXmlBinding<MyData>' requires 'template<>' syntax TiXmlBinding<MyData> const *

解决方法:

TiXmlBinding<MyData> const *

GetTiXmlBinding<MyData>( MyData const &, Identity<MyData> )

改为

TiXmlBinding<MyData> const *

GetTiXmlBinding( MyData const &, Identity<MyData> )

3、tinybind/tinybind.h:276: error: 'stricmp' was not declared in this scope

if( !stricmp(elem.Value(), tag()) ) {

解决方法: stricmp改为strcmp

4、tinybind/tinybind.h:324: error: 'ConvertFromString' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]

ConvertFromString( attributeValue, &mv );

tinybind/tinybind.h:335: error: 'ConvertToString' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]

char const * attributeValue = ConvertToString( mv );

^ ^

解决方法:

由于void ConvertFromString( char const * strIn, T * dataOut );

char const * ConvertToString( T const & t );

申明在调用者的后面,所以讲这两个申明放到前面就可以了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: