I am working on serialization of color data for SFML objects and ran into an issue where they are not supported by default, as they are not a default type. I tried making a wraparound class, which failed but I found info of adding the type to cereal itself. Based off of what I read at Serialize/deserialize SFML Vectors class using cereal, the following code supposedly should work, I have this currently in a .h file.
#include <SFML/Graphics.hpp>
#include <SFML/Config.hpp>
namespace /*cereal*/ sf
{
template<class Archive>
void serialize(Archive& archive, sf::Color& c)
{
archive(
CEREAL_NVP(this->r),
CEREAL_NVP(this->g),
CEREAL_NVP(this->b),
CEREAL_NVP(this->a)
);
}
}
however, I end up with an error still, as follows:
Error C2338 cereal could not find any output serialization functions for the provided type and archive combination. SFML_Tiles C:\Users\97cwe\Documents\Visual Studio Libraries\Cereal\cereal-1.3.2\include\cereal\cereal.hpp 570
I cannot parse the documentation to understand it more, nor does the stack overflow post linked above offer any insight. I probably need to include it somewhere, but as I don't know where, or even if this is the right format, I am asking here
Any help will be greatly appreciated. Thank you