I am trying to build a big project in Mac OS X with cmake and ran into following error which i am unable to solve.
Archive.hpp:92:30: error: base specifier must name a class
struct Derived : T, Fallback { };
Code:
template<typename T>
class has_save_func
{
struct Fallback { int save; }; // add member name "X"
struct Derived : T, Fallback { };
...
Furthermore i have following:
Archive.hpp:137:13: error: type 'unsigned long' cannot be used prior to '::'
Code:
template <class A>
static bool save(const A& data, class OutputArchive& oarchive, const std::string& id, typename boost::enable_if_c<has_save_func<A>::value, A>::type* def=NULL){
// todo check if A actually is friend with Access class, else return false
A::save(data, oarchive); // ! Error on this line !
return true;
}
template <class A>
static bool save(const A& data, class OutputArchive& oarchive, const std::string& id, typename boost::disable_if_c<has_save_func<A>::value, A>::type* def=NULL){
// todo check if A actually is friend with Access class, else return false
return serialization::save<A>( data, oarchive, id);
}
Code calling (OutputArchive.hpp):
template<class T>
void write(const T& data, const std::string& id){
// the data method must have an implementation of load/save and if not then we try the generic write
// method which could provide a solution by the implementation itself
writeEnterScope(id);
try {
Archive::Access::save<T>(data, *this, id);
} catch (...){
// we fall back to this call
boost::any adata(data);
write(adata, id);
}
writeLeaveScope(id);
}
Code serializeutil.cpp
void save(const rw::math::Q& tmp, OutputArchive& oar, const std::string& id){
oar.write(tmp.size(), "size");
for(int i=0;i<tmp.size();i++){
oar.write(tmp[i],"q");
}
}
Could it be a problem with the compiler im using?
I think that i may be responsible for the mentioned pieces of code. Something is missing though, and multiple persons already noticed this. The overloaded write functions on the OutputArchive which currently looks something like this:
The serialization part of the software was not supposed to be used yet, but it ended up in the build system anyways. If you comment out the serialize directory in CMakeLists.txt in src/rwlibs then it should work. Or add a write function for an unsigned long:
And yes, i did look into Boost.Serialization before venturing into creating yet another serialization framework. I was however trying to create something that would be less intrusive, less templated and more user friendly…. Guess i failed at that…