Created
December 19, 2013 01:50
-
-
Save randvoorhies/8033009 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rand@Randolphs-MacBook-Pro:~/workspace/sandbox$ make | |
g++-4.9 -std=c++11 main2.cpp obj1.cpp obj2.cpp -I../cereal/include | |
duplicate symbol cereal::detail::Versions::mapping in: | |
/var/folders/z8/8m9443jx2rsdv_c908pn00m00000gn/T//cceemLWz.o | |
/var/folders/z8/8m9443jx2rsdv_c908pn00m00000gn/T//cckqajum.o | |
duplicate symbol cereal::detail::Versions::mapping in: | |
/var/folders/z8/8m9443jx2rsdv_c908pn00m00000gn/T//cceemLWz.o | |
/var/folders/z8/8m9443jx2rsdv_c908pn00m00000gn/T//ccgHDFrZ.o | |
ld: 2 duplicate symbols for architecture x86_64 | |
collect2: error: ld returned 1 exit status | |
make: *** [all] Error 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "obj1.hpp" | |
#include "obj2.hpp" | |
#include <cereal/archives/xml.hpp> | |
#include <fstream> | |
int main() | |
{ | |
obj1 o1; | |
obj2 o2; | |
std::ofstream ostream("archive.xml"); | |
cereal::XMLOutputArchive oarchive(ostream); | |
oarchive( o1, o2 ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: | |
g++-4.9 -std=c++11 main2.cpp obj1.cpp obj2.cpp -I../cereal/include |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "obj1.hpp" | |
obj1::obj1() | |
{ | |
x = 99; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <cereal/access.hpp> | |
#include <cereal/cereal.hpp> | |
class obj1 | |
{ | |
public: | |
obj1(); | |
protected: | |
friend class cereal::access; | |
template <class Archive> | |
void serialize(Archive & ar) | |
{ | |
ar( cereal::make_nvp<Archive>( "x_value", x ) ); | |
} | |
int x; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "obj2.hpp" | |
obj2::obj2() | |
{ | |
y = 100; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <cereal/access.hpp> | |
#include <cereal/cereal.hpp> | |
class obj2 | |
{ | |
public: | |
obj2(); | |
protected: | |
friend class cereal::access; | |
template <class Archive> | |
void serialize(Archive & ar) | |
{ | |
ar( cereal::make_nvp<Archive>( "y_value", y ) ); | |
} | |
int y; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment