i have writing a map to an xml file using the below code , but i can't successfully compile the code , i am actually trying to compile this on mac sierras terminal .
Would you please advice what may have went wrong
#include <fstream>
#include <boost/serialization/map.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/archive/xml_oarchive.hpp>
using namespace std;
class MyConnections
{
public:
MyConnections()
{
m_connections["one"]= "one";
}
template<class archive>
void serialize(archive& ar, const unsigned int version)
{
using boost::serialization::make_nvp;
ar & make_nvp("Connections", m_connections);
}
public:
map<string,string> m_connections ;
};
int main(int argc, char* argv[])
{
std::ofstream ofs("output.xml");
const MyConnections conn;
boost::archive::xml_oarchive xml(ofs);
xml << boost::serialization::make_nvp("Connections", conn);
}
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Full Error is really huge
Undefined symbols for architecture x86_64: "boost::serialization::typeid_system::extended_type_info_typeid_0::type_register(std::type_info const&)", referenced from: boost::serialization::extended_type_info_typeid::extended_type_info_typeid() in teee-a553d7.o boost::serialization::extended_type_info_typeid, std::__1::allocator >, std::__1::basic_string, std::__1::allocator >, std::__1::less, std::__1::allocator > >, std::__1::allocator, std::__1::allocator > const, std::__1::basic_string, std::__1::allocator > > > > >::extended_type_info_typeid() in teee-a553d7.o boost::serialization::extended_type_info_typeid, std::__1::allocator > const, std::__1::basic_string, std::__1::allocator > > >::extended_type_info_typeid() in teee-a553d7.o "boost::serialization::typeid_system::extended_type_info_typeid_0::type_unregister()", referenced from: boost::serialization::extended_type_info_typeid::~extended_type_info_typeid() in teee-a553d7.o boost::serialization::extended_type_info_typeid, std::__1::allocator >, std::__1::basic_string, std::__1::allocator >, std::__1::less, std::__1::allocator > >, std::__1::allocator, std::__1::allocator > const, std::__1::basic_string, std::__1::allocator > > > > >::~extended_type_info_typeid() in teee-a553d7.o boost::serialization::extended_type_info_typeid, std::__1::allocator > const, std::__1::basic_string, std::__1::allocator > > >::~extended_type_info_typeid() in teee-a553d7.o "boost::serialization::typeid_system::extended_type_info_typeid_0::extended_type_info_typeid_0(char const*)", referenced from: boost::serialization::extended_type_info_typeid::extended_type_info_typeid() in teee-a553d7.o boost::serialization::extended_type_info_typeid, std::__1::allocator >, std::__1::basic_string, std::__1::allocator >, std::__1::less, std::__1::allocator > >, std::__1::allocator, std::__1::allocator > const, std::__1::basic_string, std::__1::allocator > > > > >::extended_type_info_typeid() in teee-a553d7.o