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 );
申明在调用者的后面,所以讲这两个申明放到前面就可以了