We are seeing a compiler error with g++ 4.8 and would like some guidance. In particular it seems related to C++11 and enumerations.
Here is the slightly shortened compiler output.
[exec] In file included from ...
[exec] .../RCF/demo/cmake/../../include/SF/Serializer.hpp: In function ‘void SF::serializeEnum(SF::Archive&, T&)’:
[exec] .../RCF/demo/cmake/../../include/SF/Serializer.hpp:253:16: error: no match for ‘operator&’ (operand types are ‘SF::Archive’ and ‘int32_t {aka int}’)
[exec] ar & n;
[exec] ^
[exec] .../RCF/demo/cmake/../../include/SF/Serializer.hpp:253:16: note: candidate is:
[exec] In file included from .../RCF/demo/cmake/../../include/SF/Stream.hpp:330:0,
[exec] from .../RCF/demo/cmake/../../include/SF/IBinaryStream.hpp:19,
[exec] from .../RCF/demo/cmake/../../include/RCF/Protocol/SF.hpp:21,
[exec] from .../RCF/demo/cmake/../../include/RCF/SerializationProtocol.hpp:40,
[exec] from .../RCF/demo/cmake/../../include/RCF/Endpoint.hpp:25,
[exec] from .../RCF/demo/cmake/../../include/RCF/ClientStub.hpp:30,
[exec] from .../RCF/src/RCF/BsdClientTransport.cpp:18,
[exec] from .../RCF/src/RCF/RCF.cpp:40:
[exec] .../RCF/demo/cmake/../../include/SF/Archive.hpp:53:21: note: SF::Archive& SF::Archive::operator&(SF::Archive::Flag) <near match>
[exec] Archive & operator&(Flag flag);
[exec] ^
[exec] .../RCF/demo/cmake/../../include/SF/Archive.hpp:53:21: note: no known conversion for argument 1 from ‘int32_t {aka int}’ to ‘SF::Archive::Flag’
[exec] In file included from ...
[exec] from .../RCF/src/RCF/BsdClientTransport.cpp:18,
[exec] from .../RCF/src/RCF/RCF.cpp:40:
[exec] .../RCF/demo/cmake/../../include/SF/Serializer.hpp:259:7: error: no match for ‘operator&’ (operand types are ‘SF::Archive’ and ‘int32_t {aka int}’)
[exec] ar & n;
[exec] ^
[exec] .../RCF/demo/cmake/../../include/SF/Serializer.hpp:259:7: note: candidate is:
[exec] In file included from ...
[exec] from .../RCF/src/RCF/BsdClientTransport.cpp:18,
[exec] from .../RCF/src/RCF/RCF.cpp:40:
[exec] .../RCF/demo/cmake/../../include/SF/Archive.hpp:53:21: note: SF::Archive& SF::Archive::operator&(SF::Archive::Flag) <near match>
[exec] Archive & operator&(Flag flag);
[exec] ^
[exec] .../RCF/demo/cmake/../../include/SF/Archive.hpp:53:21: note: no known conversion for argument 1 from ‘int32_t {aka int}’ to ‘SF::Archive::Flag’
[exec] make[2]: *** [Libraries/RCF/demo/cmake/RcfLib/CMakeFiles/RcfLib.dir/__/__/__/src/RCF/RCF.cpp.o] Error 1
[exec] make[1]: *** [Libraries/RCF/demo/cmake/RcfLib/CMakeFiles/RcfLib.dir/all] Error 2
[exec] make: *** [all] Error 2
Compiling 1.3.1 with G++ 4.8
Re: Compiling 1.3.1 with G++ 4.8
C++11 enums are not supported out-of-the-box in RCF 1.3.1. C++11 enums are supported in RCF 2.0 using the SF_SERIALIZE_ENUM_CLASS macro.
If you can't upgrade, you can either write some custom serialization code of your own, or backport the SF_SERIALIZE_ENUM_CLASS macro. Try including this in your code:
, and then use SF_SERIALIZE_ENUM_CLASS , as described here:
http://www.deltavsoft.com/doc/rcf_user_ ... _c___types
If you can't upgrade, you can either write some custom serialization code of your own, or backport the SF_SERIALIZE_ENUM_CLASS macro. Try including this in your code:
Code: Select all
template<typename T, typename U>
inline void serializeAs(Archive & ar, T &t)
{
if (ar.isWrite())
{
U u = static_cast<U>(t);
ar & u;
}
else
{
U u;
ar & u;
t = static_cast<T>(u);
}
}
#define SF_SERIALIZE_ENUM_CLASS(EnumType, BaseType) \
void serialize(SF::Archive & ar, EnumType & e) \
{ \
SF::serializeAs<EnumType, BaseType>(ar, e); \
}
http://www.deltavsoft.com/doc/rcf_user_ ... _c___types