can't build example boost serialization - c++

i have tried to build the first example i found here: Boost serialization tutorial
but i get this error:
Undefined symbols:
"boost::archive::archive_exception::~archive_exception()", referenced from:
void boost::serialization::throw_exception<boost::archive::archive_exception>(boost::archive::archive_exception const&)in main.o
void boost::archive::basic_text_iprimitive<std::basic_istream<char, std::char_traits<char> > >::load<int>(int&)in main.o
void boost::archive::basic_text_iprimitive<std::basic_istream<char, std::char_traits<char> > >::load<int>(int&)in main.o
void boost::archive::basic_text_iprimitive<std::basic_istream<char, std::char_traits<char> > >::load<float>(float&)in main.o
void boost::archive::basic_text_iprimitive<std::basic_istream<char, std::char_traits<char> > >::load<float>(float&)in main.o
boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save(float)in main.o
boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save(float)in main.o
void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<boost::archive::tracking_type>(boost::archive::tracking_type const&)in main.o
void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<boost::archive::tracking_type>(boost::archive::tracking_type const&)in main.o
void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<boost::archive::object_reference_type>(boost::archive::object_reference_type const&)in main.o
void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<boost::archive::object_reference_type>(boost::archive::object_reference_type const&)in main.o
void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<boost::archive::object_id_type>(boost::archive::object_id_type const&)in main.o
void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<boost::archive::object_id_type>(boost::archive::object_id_type const&)in main.o
void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<unsigned int>(unsigned int const&)in main.o
void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<unsigned int>(unsigned int const&)in main.o
void boost::archive::basic_text_iprimitive<std::basic_istream<char, std::char_traits<char> > >::load<boost::archive::tracking_type>(boost::archive::tracking_type&)in main.o
void boost::archive::basic_text_iprimitive<std::basic_istream<char, std::char_traits<char> > >::load<boost::archive::tracking_type>(boost::archive::tracking_type&)in main.o
void boost::archive::basic_text_iprimitive<std::basic_istream<char, std::char_traits<char> > >::load<boost::archive::object_id_type>(boost::archive::object_id_type&)in main.o
void boost::archive::basic_text_iprimitive<std::basic_istream<char, std::char_traits<char> > >::load<boost::archive::object_id_type>(boost::archive::object_id_type&)in main.o
void boost::archive::basic_text_iprimitive<std::basic_istream<char, std::char_traits<char> > >::load<unsigned int>(unsigned int&)in main.o
void boost::archive::basic_text_iprimitive<std::basic_istream<char, std::char_traits<char> > >::load<unsigned int>(unsigned int&)in main.o
void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<int>(int const&)in main.o
void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<int>(int const&)in main.o
void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<boost::archive::class_id_reference_type>(boost::archive::class_id_reference_type const&)in main.o
void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<boost::archive::class_id_reference_type>(boost::archive::class_id_reference_type const&)in main.o
void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<boost::archive::class_id_type>(boost::archive::class_id_type const&)in main.o
void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<boost::archive::class_id_type>(boost::archive::class_id_type const&)in main.o
void boost::archive::basic_text_iprimitive<std::basic_istream<char, std::char_traits<char> > >::load<boost::archive::class_id_type>(boost::archive::class_id_type&)in main.o
void boost::archive::basic_text_iprimitive<std::basic_istream<char, std::char_traits<char> > >::load<boost::archive::class_id_type>(boost::archive::class_id_type&)in main.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<gps_position>::extended_type_info_typeid()in main.o
"boost::archive::detail::basic_oarchive::end_preamble()", referenced from:
void boost::archive::save_access::save_primitive<boost::archive::text_oarchive, float>(boost::archive::text_oarchive&, float const&)in main.o
void boost::archive::save_access::save_primitive<boost::archive::text_oarchive, boost::archive::tracking_type>(boost::archive::text_oarchive&, boost::archive::tracking_type const&)in main.o
void boost::archive::save_access::save_primitive<boost::archive::text_oarchive, boost::archive::object_reference_type>(boost::archive::text_oarchive&, boost::archive::object_reference_type const&)in main.o
void boost::archive::save_access::save_primitive<boost::archive::text_oarchive, boost::archive::object_id_type>(boost::archive::text_oarchive&, boost::archive::object_id_type const&)in main.o
void boost::archive::save_access::save_primitive<boost::archive::text_oarchive, boost::archive::version_type>(boost::archive::text_oarchive&, boost::archive::version_type const&)in main.o
void boost::archive::save_access::save_primitive<boost::archive::text_oarchive, int>(boost::archive::text_oarchive&, int const&)in main.o
void boost::archive::save_access::save_primitive<boost::archive::text_oarchive, boost::archive::class_id_reference_type>(boost::archive::text_oarchive&, boost::archive::class_id_reference_type const&)in main.o
void boost::archive::save_access::save_primitive<boost::archive::text_oarchive, boost::archive::class_id_type>(boost::archive::text_oarchive&, boost::archive::class_id_type const&)in main.o
void boost::archive::save_access::save_primitive<boost::archive::text_oarchive, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >(boost::archive::text_oarchive&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in main.o
"typeinfo for boost::archive::detail::basic_oarchive", referenced from:
boost::archive::text_oarchive& boost::serialization::smart_cast_impl::reference<boost::archive::text_oarchive&>::polymorphic::cross::cast<boost::archive::detail::basic_oarchive>(boost::archive::detail::basic_oarchive&)in main.o
typeinfo for boost::archive::detail::common_oarchive<boost::archive::text_oarchive>in main.o
"boost::archive::text_iarchive_impl<boost::archive::text_iarchive>::load_override(boost::archive::class_name_type&, int)", referenced from:
boost::archive::text_iarchive& boost::archive::detail::interface_iarchive<boost::archive::text_iarchive>::operator>><boost::archive::class_name_type>(boost::archive::class_name_type&)in main.o
"boost::archive::detail::basic_oserializer::~basic_oserializer()", referenced from:
boost::archive::detail::oserializer<boost::archive::text_oarchive, gps_position>::~oserializer()in main.o
boost::archive::detail::oserializer<boost::archive::text_oarchive, gps_position>::~oserializer()in main.o
boost::archive::detail::oserializer<boost::archive::text_oarchive, gps_position>::~oserializer()in main.o
"boost::archive::archive_exception::archive_exception(boost::archive::archive_exception::exception_code, char const*, char const*)", referenced from:
void boost::archive::basic_text_iprimitive<std::basic_istream<char, std::char_traits<char> > >::load<int>(int&)in main.o
void boost::archive::basic_text_iprimitive<std::basic_istream<char, std::char_traits<char> > >::load<float>(float&)in main.o
boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save(float)in main.o
void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<boost::archive::tracking_type>(boost::archive::tracking_type const&)in main.o
void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<boost::archive::object_reference_type>(boost::archive::object_reference_type const&)in main.o
void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<boost::archive::object_id_type>(boost::archive::object_id_type const&)in main.o
void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<unsigned int>(unsigned int const&)in main.o
void boost::archive::basic_text_iprimitive<std::basic_istream<char, std::char_traits<char> > >::load<boost::archive::tracking_type>(boost::archive::tracking_type&)in main.o
void boost::archive::basic_text_iprimitive<std::basic_istream<char, std::char_traits<char> > >::load<boost::archive::object_id_type>(boost::archive::object_id_type&)in main.o
void boost::archive::basic_text_iprimitive<std::basic_istream<char, std::char_traits<char> > >::load<unsigned int>(unsigned int&)in main.o
void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<int>(int const&)in main.o
void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<boost::archive::class_id_reference_type>(boost::archive::class_id_reference_type const&)in main.o
void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<boost::archive::class_id_type>(boost::archive::class_id_type const&)in main.o
void boost::archive::basic_text_iprimitive<std::basic_istream<char, std::char_traits<char> > >::load<boost::archive::class_id_type>(boost::archive::class_id_type&)in main.o
"typeinfo for boost::archive::archive_exception", referenced from:
void boost::serialization::throw_exception<boost::archive::archive_exception>(boost::archive::archive_exception const&)in main.o
"boost::archive::basic_text_iprimitive<std::basic_istream<char, std::char_traits<char> > >::~basic_text_iprimitive()", referenced from:
boost::archive::text_iarchive_impl<boost::archive::text_iarchive>::~text_iarchive_impl()in main.o
boost::archive::text_iarchive_impl<boost::archive::text_iarchive>::~text_iarchive_impl()in main.o
boost::archive::text_iarchive_impl<boost::archive::text_iarchive>::~text_iarchive_impl()in main.o
boost::archive::text_iarchive_impl<boost::archive::text_iarchive>::~text_iarchive_impl()in main.o
boost::archive::text_iarchive_impl<boost::archive::text_iarchive>::~text_iarchive_impl()in main.o
boost::archive::text_iarchive_impl<boost::archive::text_iarchive>::~text_iarchive_impl()in main.o
"vtable for boost::archive::archive_exception", referenced from:
boost::archive::archive_exception::archive_exception(boost::archive::archive_exception const&)in main.o
boost::archive::archive_exception::archive_exception(boost::archive::archive_exception const&)in main.o
"boost::serialization::extended_type_info::key_unregister() const", referenced from:
boost::serialization::extended_type_info_typeid<gps_position>::~extended_type_info_typeid()in main.o
boost::serialization::extended_type_info_typeid<gps_position>::~extended_type_info_typeid()in main.o
boost::serialization::extended_type_info_typeid<gps_position>::~extended_type_info_typeid()in main.o
"boost::archive::text_iarchive_impl<boost::archive::text_iarchive>::text_iarchive_impl(std::basic_istream<char, std::char_traits<char> >&, unsigned int)", referenced from:
boost::archive::text_iarchive::text_iarchive(std::basic_istream<char, std::char_traits<char> >&, unsigned int)in main.o
"boost::serialization::typeid_system::extended_type_info_typeid_0::is_equal(boost::serialization::extended_type_info const&) const", referenced from:
vtable for boost::serialization::detail::singleton_wrapper<boost::serialization::extended_type_info_typeid<gps_position> >in main.o
vtable for boost::serialization::extended_type_info_typeid<gps_position>in main.o
"boost::serialization::typeid_system::extended_type_info_typeid_0::~extended_type_info_typeid_0()", referenced from:
boost::serialization::extended_type_info_typeid<gps_position>::~extended_type_info_typeid()in main.o
boost::serialization::extended_type_info_typeid<gps_position>::~extended_type_info_typeid()in main.o
boost::serialization::extended_type_info_typeid<gps_position>::~extended_type_info_typeid()in main.o
boost::serialization::extended_type_info_typeid<gps_position>::~extended_type_info_typeid()in main.o
boost::serialization::extended_type_info_typeid<gps_position>::~extended_type_info_typeid()in main.o
boost::serialization::extended_type_info_typeid<gps_position>::~extended_type_info_typeid()in main.o
boost::serialization::extended_type_info_typeid<gps_position>::extended_type_info_typeid()in main.o
"boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
void boost::archive::save_access::save_primitive<boost::archive::text_oarchive, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >(boost::archive::text_oarchive&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in main.o
"boost::archive::detail::basic_oarchive::~basic_oarchive()", referenced from:
boost::archive::detail::common_oarchive<boost::archive::text_oarchive>::~common_oarchive()in main.o
boost::archive::detail::common_oarchive<boost::archive::text_oarchive>::~common_oarchive()in main.o
boost::archive::detail::common_oarchive<boost::archive::text_oarchive>::~common_oarchive()in main.o
"typeinfo for boost::archive::detail::basic_iarchive", referenced from:
boost::archive::text_iarchive& boost::serialization::smart_cast_impl::reference<boost::archive::text_iarchive&>::polymorphic::cross::cast<boost::archive::detail::basic_iarchive>(boost::archive::detail::basic_iarchive&)in main.o
typeinfo for boost::archive::detail::common_iarchive<boost::archive::text_iarchive>in main.o
"boost::serialization::typeid_system::extended_type_info_typeid_0::type_unregister()", referenced from:
boost::serialization::extended_type_info_typeid<gps_position>::~extended_type_info_typeid()in main.o
boost::serialization::extended_type_info_typeid<gps_position>::~extended_type_info_typeid()in main.o
boost::serialization::extended_type_info_typeid<gps_position>::~extended_type_info_typeid()in main.o
"boost::archive::detail::basic_iarchive::load_object(void*, boost::archive::detail::basic_iserializer const&)", referenced from:
void boost::archive::detail::load_non_pointer_type<boost::archive::text_iarchive>::load_standard::invoke<gps_position>(boost::archive::text_iarchive&, gps_position const&)in main.o
"typeinfo for boost::archive::detail::basic_oserializer", referenced from:
typeinfo for boost::archive::detail::oserializer<boost::archive::text_oarchive, gps_position>in main.o
"boost::serialization::extended_type_info::key_register() const", referenced from:
boost::serialization::extended_type_info_typeid<gps_position>::extended_type_info_typeid()in main.o
"boost::archive::detail::basic_iserializer::basic_iserializer(boost::serialization::extended_type_info const&)", referenced from:
boost::archive::detail::iserializer<boost::archive::text_iarchive, gps_position>::iserializer()in main.o
"boost::archive::detail::basic_iarchive::~basic_iarchive()", referenced from:
boost::archive::detail::common_iarchive<boost::archive::text_iarchive>::~common_iarchive()in main.o
boost::archive::detail::common_iarchive<boost::archive::text_iarchive>::~common_iarchive()in main.o
boost::archive::detail::common_iarchive<boost::archive::text_iarchive>::~common_iarchive()in main.o
"boost::archive::detail::shared_ptr_helper::shared_ptr_helper()", referenced from:
boost::archive::text_iarchive::text_iarchive(std::basic_istream<char, std::char_traits<char> >&, unsigned int)in main.o
"boost::archive::detail::basic_iserializer::~basic_iserializer()", referenced from:
boost::archive::detail::iserializer<boost::archive::text_iarchive, gps_position>::~iserializer()in main.o
boost::archive::detail::iserializer<boost::archive::text_iarchive, gps_position>::~iserializer()in main.o
boost::archive::detail::iserializer<boost::archive::text_iarchive, gps_position>::~iserializer()in main.o
"boost::archive::basic_text_oarchive<boost::archive::text_oarchive>::newtoken()", referenced from:
void boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save<float>(float const&)in main.o
void boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save<boost::archive::tracking_type>(boost::archive::tracking_type const&)in main.o
void boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save<boost::archive::object_reference_type>(boost::archive::object_reference_type const&)in main.o
void boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save<boost::archive::object_id_type>(boost::archive::object_id_type const&)in main.o
void boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save<unsigned int>(unsigned int const&)in main.o
void boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save<int>(int const&)in main.o
void boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save<boost::archive::class_id_reference_type>(boost::archive::class_id_reference_type const&)in main.o
void boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save<boost::archive::class_id_type>(boost::archive::class_id_type const&)in main.o
"typeinfo for boost::archive::detail::basic_iserializer", referenced from:
typeinfo for boost::archive::detail::iserializer<boost::archive::text_iarchive, gps_position>in main.o
"typeinfo for boost::serialization::typeid_system::extended_type_info_typeid_0", referenced from:
typeinfo for boost::serialization::extended_type_info_typeid<gps_position>in main.o
"boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::text_oarchive_impl(std::basic_ostream<char, std::char_traits<char> >&, unsigned int)", referenced from:
boost::archive::text_oarchive::text_oarchive(std::basic_ostream<char, std::char_traits<char> >&, unsigned int)in main.o
"boost::archive::detail::shared_ptr_helper::~shared_ptr_helper()", referenced from:
boost::archive::text_iarchive::~text_iarchive()in main.o
boost::archive::text_iarchive::~text_iarchive()in main.o
"boost::serialization::typeid_system::extended_type_info_typeid_0::type_register(std::type_info const&)", referenced from:
boost::serialization::extended_type_info_typeid<gps_position>::extended_type_info_typeid()in main.o
"boost::archive::detail::basic_oarchive::save_object(void const*, boost::archive::detail::basic_oserializer const&)", referenced from:
void boost::archive::detail::save_non_pointer_type<boost::archive::text_oarchive>::save_standard::invoke<gps_position>(boost::archive::text_oarchive&, gps_position const&)in main.o
"boost::serialization::typeid_system::extended_type_info_typeid_0::is_less_than(boost::serialization::extended_type_info const&) const", referenced from:
vtable for boost::serialization::detail::singleton_wrapper<boost::serialization::extended_type_info_typeid<gps_position> >in main.o
vtable for boost::serialization::extended_type_info_typeid<gps_position>in main.o
"boost::archive::detail::basic_oserializer::basic_oserializer(boost::serialization::extended_type_info const&)", referenced from:
boost::archive::detail::oserializer<boost::archive::text_oarchive, gps_position>::oserializer()in main.o
"boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::~basic_text_oprimitive()", referenced from:
boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::~text_oarchive_impl()in main.o
boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::~text_oarchive_impl()in main.o
boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::~text_oarchive_impl()in main.o
boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::~text_oarchive_impl()in main.o
boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::~text_oarchive_impl()in main.o
boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::~text_oarchive_impl()in main.o
ld: symbol(s) not found
i really can't understand where i'm wrong. my code is exactly the same as the example.
can someone explain how to solve this?

It seems that you do not link boost serialization.
Right click on your project, go to Properties, under the Build tab look for Linker. There you need to specify your link path and your dynamic/static libraries.

You must be sure that the compiler version that compile your application and your boost library are the same... I got similar error message when I try to link a library compile with tow different version of compiler, g++ 4.1 and g++ 4.4 as exemple...

Related

Boost log linking error on OSX

I've been trying to compile the following example program from the boost tutorial to create a logger all morning and can't work out what I'm doing wrong:
#include <boost/log/common.hpp>
#include <boost/log/sinks.hpp>
#include <boost/log/sources/severity_logger.hpp>
#include <boost/log/expressions.hpp>
#include <boost/core/null_deleter.hpp>
#include <boost/shared_ptr.hpp>
#include <iostream>
using namespace boost::log;
BOOST_LOG_ATTRIBUTE_KEYWORD(severity, "Severity", int)
int main()
{
typedef sinks::asynchronous_sink<sinks::text_ostream_backend> text_sink;
boost::shared_ptr<text_sink> sink = boost::make_shared<text_sink>();
boost::shared_ptr<std::ostream> stream{&std::clog,
boost::null_deleter{}};
sink->locked_backend()->add_stream(stream);
sink->set_filter(severity > 0);
sink->set_formatter(expressions::stream << severity << ": " <<
expressions::smessage);
core::get()->add_sink(sink);
sources::severity_logger<int> lg;
BOOST_LOG_SEV(lg, 0) << "note";
BOOST_LOG_SEV(lg, 1) << "warning";
BOOST_LOG_SEV(lg, 2) << "error";
sink->flush();
}
using the following commands:
clang -std=c++11 -c ./test.cpp -Wall -DBOOST_ALL_NO_LIB -DBOOST_ALL_DYN_LINK -DBOOST_LOG_DYN_LINK
clang test.o -o test -DBOOST_ALL_NO_LIB -DBOOST_ALL_DYN_LINK -DBOOST_LOG_DYN_LINK
And I'm met with a massive error message that ends like this:
vtable for boost::log::v2s_mt_posix::attribute::impl in test-7198fd.o
vtable for boost::detail::sp_counted_base in test-7198fd.o
vtable for boost::log::v2s_mt_posix::sinks::basic_formatting_sink_frontend<char> in test-7198fd.o
vtable for boost::log::v2s_mt_posix::sinks::basic_sink_frontend in test-7198fd.o
vtable for boost::log::v2s_mt_posix::sinks::sink in test-7198fd.o
vtable for boost::detail::tss_cleanup_function in test-7198fd.o
...
"___cxa_rethrow", referenced from:
boost::detail::shared_count::shared_count<boost::log::v2s_mt_posix::sinks::asynchronous_sink<boost::log::v2s_mt_posix::sinks::basic_text_ostream_backend<char>, boost::log::v2s_mt_posix::sinks::unbounded_fifo_queue>*, boost::detail::sp_ms_deleter<boost::log::v2s_mt_posix::sinks::asynchronous_sink<boost::log::v2s_mt_posix::sinks::basic_text_ostream_backend<char>, boost::log::v2s_mt_posix::sinks::unbounded_fifo_queue> > >(boost::log::v2s_mt_posix::sinks::asynchronous_sink<boost::log::v2s_mt_posix::sinks::basic_text_ostream_backend<char>, boost::log::v2s_mt_posix::sinks::unbounded_fifo_queue>*, boost::detail::sp_inplace_tag<boost::detail::sp_ms_deleter<boost::log::v2s_mt_posix::sinks::asynchronous_sink<boost::log::v2s_mt_posix::sinks::basic_text_ostream_backend<char>, boost::log::v2s_mt_posix::sinks::unbounded_fifo_queue> > >) in test-7198fd.o
boost::log::v2s_mt_posix::sinks::basic_sink_frontend::will_consume(boost::log::v2s_mt_posix::attribute_value_set const&) in test-7198fd.o
boost::log::v2s_mt_posix::visitation_result boost::log::v2s_mt_posix::value_visitor_invoker<boost::mpl::vector2<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > >, boost::log::v2s_mt_posix::fallback_to_none>::operator()<boost::log::v2s_mt_posix::binder1st<boost::log::v2s_mt_posix::output_fun, boost::log::v2s_mt_posix::expressions::aux::stream_ref<boost::log::v2s_mt_posix::basic_formatting_ostream<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&> >(boost::log::v2s_mt_posix::attribute_name const&, boost::log::v2s_mt_posix::attribute_value_set const&, boost::log::v2s_mt_posix::binder1st<boost::log::v2s_mt_posix::output_fun, boost::log::v2s_mt_posix::expressions::aux::stream_ref<boost::log::v2s_mt_posix::basic_formatting_ostream<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&>) const in test-7198fd.o
boost::detail::shared_count::shared_count<boost::thread_specific_ptr<boost::log::v2s_mt_posix::sinks::basic_formatting_sink_frontend<char>::formatting_context>::delete_data*, boost::detail::do_heap_delete<boost::thread_specific_ptr<boost::log::v2s_mt_posix::sinks::basic_formatting_sink_frontend<char>::formatting_context>::delete_data> >(boost::thread_specific_ptr<boost::log::v2s_mt_posix::sinks::basic_formatting_sink_frontend<char>::formatting_context>::delete_data*, boost::detail::do_heap_delete<boost::thread_specific_ptr<boost::log::v2s_mt_posix::sinks::basic_formatting_sink_frontend<char>::formatting_context>::delete_data>) in test-7198fd.o
boost::log::v2s_mt_posix::aux::threadsafe_queue<boost::log::v2s_mt_posix::record_view, std::__1::allocator<void> >::threadsafe_queue(std::__1::allocator<boost::log::v2s_mt_posix::aux::threadsafe_queue_types<boost::log::v2s_mt_posix::record_view, std::__1::allocator<void> >::node> const&) in test-7198fd.o
boost::detail::shared_count::shared_count<boost::log::v2s_mt_posix::sinks::basic_text_ostream_backend<char>*, boost::detail::sp_ms_deleter<boost::log::v2s_mt_posix::sinks::basic_text_ostream_backend<char> > >(boost::log::v2s_mt_posix::sinks::basic_text_ostream_backend<char>*, boost::detail::sp_inplace_tag<boost::detail::sp_ms_deleter<boost::log::v2s_mt_posix::sinks::basic_text_ostream_backend<char> > >) in test-7198fd.o
void boost::log::v2s_mt_posix::sinks::basic_formatting_sink_frontend<char>::feed_record<boost::recursive_mutex, boost::log::v2s_mt_posix::sinks::basic_text_ostream_backend<char> >(boost::log::v2s_mt_posix::record_view const&, boost::recursive_mutex&, boost::log::v2s_mt_posix::sinks::basic_text_ostream_backend<char>&) in test-7198fd.o
...
"___cxa_throw", referenced from:
boost::log::v2s_mt_posix::aux::threadsafe_queue<boost::log::v2s_mt_posix::record_view, std::__1::allocator<void> >::threadsafe_queue(std::__1::allocator<boost::log::v2s_mt_posix::aux::threadsafe_queue_types<boost::log::v2s_mt_posix::record_view, std::__1::allocator<void> >::node> const&) in test-7198fd.o
void boost::throw_exception<boost::thread_resource_error>(boost::thread_resource_error const&) in test-7198fd.o
boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::thread_resource_error> >::rethrow() const in test-7198fd.o
void boost::throw_exception<boost::lock_error>(boost::lock_error const&) in test-7198fd.o
boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::lock_error> >::rethrow() const in test-7198fd.o
void boost::throw_exception<boost::condition_error>(boost::condition_error const&) in test-7198fd.o
boost::detail::interruption_checker::check_for_interruption() in test-7198fd.o
...
"___gxx_personality_v0", referenced from:
_main in test-7198fd.o
boost::system::system_error::what() const in test-7198fd.o
boost::detail::sp_if_not_array<boost::log::v2s_mt_posix::sinks::asynchronous_sink<boost::log::v2s_mt_posix::sinks::basic_text_ostream_backend<char>, boost::log::v2s_mt_posix::sinks::unbounded_fifo_queue> >::type boost::make_shared<boost::log::v2s_mt_posix::sinks::asynchronous_sink<boost::log::v2s_mt_posix::sinks::basic_text_ostream_backend<char>, boost::log::v2s_mt_posix::sinks::unbounded_fifo_queue> >() in test-7198fd.o
void boost::log::v2s_mt_posix::sinks::basic_sink_frontend::set_filter<boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::greater, boost::proto::argsns_::list2<boost::log::v2s_mt_posix::expressions::attribute_actor<int, boost::log::v2s_mt_posix::fallback_to_none, tag::severity, boost::phoenix::actor>, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<int>, 0l> > >, 2l> > >(boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::greater, boost::proto::argsns_::list2<boost::log::v2s_mt_posix::expressions::attribute_actor<int, boost::log::v2s_mt_posix::fallback_to_none, tag::severity, boost::phoenix::actor>, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<int>, 0l> > >, 2l> > const&) in test-7198fd.o
void boost::log::v2s_mt_posix::sinks::basic_formatting_sink_frontend<char>::set_formatter<boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::shift_left, boost::proto::argsns_::list2<boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::shift_left, boost::proto::argsns_::list2<boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::shift_left, boost::proto::argsns_::list2<boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<boost::phoenix::argument<2> >, 0l> >, boost::log::v2s_mt_posix::expressions::attribute_actor<int, boost::log::v2s_mt_posix::fallback_to_none, tag::severity, boost::phoenix::actor> >, 2l> >, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<char [3]>, 0l> > >, 2l> >, boost::log::v2s_mt_posix::expressions::attribute_actor<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, boost::log::v2s_mt_posix::fallback_to_none, boost::log::v2s_mt_posix::expressions::tag::smessage, boost::phoenix::actor> >, 2l> > >(boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::shift_left, boost::proto::argsns_::list2<boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::shift_left, boost::proto::argsns_::list2<boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::shift_left, boost::proto::argsns_::list2<boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<boost::phoenix::argument<2> >, 0l> >, boost::log::v2s_mt_posix::expressions::attribute_actor<int, boost::log::v2s_mt_posix::fallback_to_none, tag::severity, boost::phoenix::actor> >, 2l> >, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<char [3]>, 0l> > >, 2l> >, boost::log::v2s_mt_posix::expressions::attribute_actor<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, boost::log::v2s_mt_posix::fallback_to_none, boost::log::v2s_mt_posix::expressions::tag::smessage, boost::phoenix::actor> >, 2l> > const&) in test-7198fd.o
boost::log::v2s_mt_posix::aux::record_pump<boost::log::v2s_mt_posix::sources::severity_logger<int> >::stream() const in test-7198fd.o
boost::detail::shared_count::~shared_count() in test-7198fd.o
...
ld: symbol(s) not found for architecture x86_64
Boost was installed using:
brew install boost --c++11
Any ideas what's going on?
UPDATE
Having accidentally tried to compile the code in C as pointed out by gavinb, I've tried to recompile using the correct c++ compiler:
c++ -std=c++11 -c ./test.cpp -Wall -DBOOST_ALL_NO_LIB -DBOOST_ALL_DYN_LINK -DBOOST_LOG_DYN_LINK
c++ test.o -o test -DBOOST_ALL_NO_LIB -DBOOST_ALL_DYN_LINK -DBOOST_LOG_DYN_LINK
and now receive the following error:
st::thread_specific_ptr<boost::log::v2_mt_posix::sinks::basic_formatting_sink_frontend<char>::formatting_context>::get() const in test.o
"boost::detail::set_tss_data(void const*, boost::shared_ptr<boost::detail::tss_cleanup_function>, void*, bool)", referenced from:
boost::thread_specific_ptr<boost::log::v2_mt_posix::sinks::basic_formatting_sink_frontend<char>::formatting_context>::reset(boost::log::v2_mt_posix::sinks::basic_formatting_sink_frontend<char>::formatting_context*) in test.o
boost::thread_specific_ptr<boost::log::v2_mt_posix::sinks::basic_formatting_sink_frontend<char>::formatting_context>::~thread_specific_ptr() in test.o
"boost::detail::thread_data_base::~thread_data_base()", referenced from:
boost::detail::thread_data<boost::_bi::bind_t<void, boost::_mfi::mf0<void, boost::log::v2_mt_posix::sinks::asynchronous_sink<boost::log::v2_mt_posix::sinks::basic_text_ostream_backend<char>, boost::log::v2_mt_posix::sinks::unbounded_fifo_queue> >, boost::_bi::list1<boost::_bi::value<boost::log::v2_mt_posix::sinks::asynchronous_sink<boost::log::v2_mt_posix::sinks::basic_text_ostream_backend<char>, boost::log::v2_mt_posix::sinks::unbounded_fifo_queue>*> > > >::~thread_data() in test.o
"boost::detail::get_current_thread_data()", referenced from:
boost::detail::interruption_checker::interruption_checker(_opaque_pthread_mutex_t*, _opaque_pthread_cond_t*) in test.o
"boost::system::system_category()", referenced from:
___cxx_global_var_init2 in test.o
boost::thread_exception::thread_exception(int, char const*) in test.o
boost::condition_error::condition_error(int, char const*) in test.o
"boost::system::generic_category()", referenced from:
___cxx_global_var_init in test.o
___cxx_global_var_init1 in test.o
"boost::thread::join_noexcept()", referenced from:
boost::thread::join() in test.o
"boost::thread::native_handle()", referenced from:
boost::thread::get_id() const in test.o
"boost::thread::start_thread_noexcept()", referenced from:
boost::thread::start_thread() in test.o
"boost::thread::detach()", referenced from:
boost::thread::~thread() in test.o
"boost::thread::thread()", referenced from:
boost::log::v2_mt_posix::sinks::asynchronous_sink<boost::log::v2_mt_posix::sinks::basic_text_ostream_backend<char>, boost::log::v2_mt_posix::sinks::unbounded_fifo_queue>::asynchronous_sink(bool) in test.o
"boost::log::v2_mt_posix::attribute_value_set::end() const", referenced from:
boost::log::v2_mt_posix::visitation_result boost::log::v2_mt_posix::value_visitor_invoker<boost::mpl::vector2<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > >, boost::log::v2_mt_posix::fallback_to_none>::operator()<boost::log::v2_mt_posix::binder1st<boost::log::v2_mt_posix::output_fun, boost::log::v2_mt_posix::expressions::aux::stream_ref<boost::log::v2_mt_posix::basic_formatting_ostream<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&> >(boost::log::v2_mt_posix::attribute_name const&, boost::log::v2_mt_posix::attribute_value_set const&, boost::log::v2_mt_posix::binder1st<boost::log::v2_mt_posix::output_fun, boost::log::v2_mt_posix::expressions::aux::stream_ref<boost::log::v2_mt_posix::basic_formatting_ostream<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&>) const in test.o
boost::log::v2_mt_posix::value_extractor<int, boost::log::v2_mt_posix::fallback_to_none, tag::severity>::operator()(boost::log::v2_mt_posix::attribute_name const&, boost::log::v2_mt_posix::attribute_value_set const&) const in test.o
boost::log::v2_mt_posix::value_extractor<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, boost::log::v2_mt_posix::fallback_to_none, boost::log::v2_mt_posix::expressions::tag::smessage>::operator()(boost::log::v2_mt_posix::attribute_name const&, boost::log::v2_mt_posix::attribute_value_set const&) const in test.o
"boost::log::v2_mt_posix::attribute_value_set::find(boost::log::v2_mt_posix::attribute_name) const", referenced from:
boost::log::v2_mt_posix::visitation_result boost::log::v2_mt_posix::value_visitor_invoker<boost::mpl::vector2<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > >, boost::log::v2_mt_posix::fallback_to_none>::operator()<boost::log::v2_mt_posix::binder1st<boost::log::v2_mt_posix::output_fun, boost::log::v2_mt_posix::expressions::aux::stream_ref<boost::log::v2_mt_posix::basic_formatting_ostream<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&> >(boost::log::v2_mt_posix::attribute_name const&, boost::log::v2_mt_posix::attribute_value_set const&, boost::log::v2_mt_posix::binder1st<boost::log::v2_mt_posix::output_fun, boost::log::v2_mt_posix::expressions::aux::stream_ref<boost::log::v2_mt_posix::basic_formatting_ostream<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&>) const in test.o
boost::log::v2_mt_posix::value_extractor<int, boost::log::v2_mt_posix::fallback_to_none, tag::severity>::operator()(boost::log::v2_mt_posix::attribute_name const&, boost::log::v2_mt_posix::attribute_value_set const&) const in test.o
boost::log::v2_mt_posix::value_extractor<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, boost::log::v2_mt_posix::fallback_to_none, boost::log::v2_mt_posix::expressions::tag::smessage>::operator()(boost::log::v2_mt_posix::attribute_name const&, boost::log::v2_mt_posix::attribute_value_set const&) const in test.o
"boost::log::v2_mt_posix::aux::once_block_sentry::enter_once_block() const", referenced from:
boost::log::v2_mt_posix::aux::once_block_sentry::executed() const in test.o
"boost::log::v2_mt_posix::core::get_logging_enabled() const", referenced from:
boost::log::v2_mt_posix::record boost::log::v2_mt_posix::sources::basic_composite_logger<char, boost::log::v2_mt_posix::sources::severity_logger<int>, boost::log::v2_mt_posix::sources::single_thread_model, boost::log::v2_mt_posix::sources::features<boost::log::v2_mt_posix::sources::severity<int> > >::open_record<boost::parameter::aux::tagged_argument<boost::log::v2_mt_posix::keywords::tag::severity, int const> >(boost::parameter::aux::tagged_argument<boost::log::v2_mt_posix::keywords::tag::severity, int const> const&) in test.o
"boost::thread::joinable() const", referenced from:
boost::log::v2_mt_posix::sinks::asynchronous_sink<boost::log::v2_mt_posix::sinks::basic_text_ostream_backend<char>, boost::log::v2_mt_posix::sinks::unbounded_fifo_queue>::flush() in test.o
boost::log::v2_mt_posix::sinks::asynchronous_sink<boost::log::v2_mt_posix::sinks::basic_text_ostream_backend<char>, boost::log::v2_mt_posix::sinks::unbounded_fifo_queue>::stop() in test.o
"typeinfo for boost::detail::thread_data_base", referenced from:
typeinfo for boost::detail::thread_data<boost::_bi::bind_t<void, boost::_mfi::mf0<void, boost::log::v2_mt_posix::sinks::asynchronous_sink<boost::log::v2_mt_posix::sinks::basic_text_ostream_backend<char>, boost::log::v2_mt_posix::sinks::unbounded_fifo_queue> >, boost::_bi::list1<boost::_bi::value<boost::log::v2_mt_posix::sinks::asynchronous_sink<boost::log::v2_mt_posix::sinks::basic_text_ostream_backend<char>, boost::log::v2_mt_posix::sinks::unbounded_fifo_queue>*> > > > in test.o
"vtable for boost::detail::thread_data_base", referenced from:
boost::detail::thread_data_base::thread_data_base() in test.o
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Finally found a command that solved the problem:
clang++ -std=c++11 -DBOOST_LOG_DYN_LINK ./test.cpp -o test -lboost_log-mt -lpthread -lboost_thread-mt -lboost_system-mt
These symbols belong to the C++ runtime:
___cxa_throw
___gxx_personality_v0
When the linker complains these are missing, it is because you are linking the app as a C app rather than a C++ app.
Rather than invoking clang, just use c++ for both compiling and linking and it should work.
Some Boost libraries are header-only (being heavily templated), which means the implementation is completely provided by headers and thus does not require linking a separate library. But some Boost libraries (check the documentation as this is specifically noted) require linking a .so or .dylib for the implementation. This requires specifying the library name with the -l flag, such as -lboost_thread-mt and possibly the -L flag if the libraries aren't on your library path.
In your case, both the threading and logging libraries need their own libraries added to the link stage, and these also depend on the system library (a common/shared library). As you discovered, this means adding the following to the link phase:
-lpthread -lboost_log-mt -lboost_thread-mt -lboost_system-mt

Boost Serialization example Error: symbol(s) not found for architecture x86_64

When I try to build/run a boost-Serialization example-code program, I'm getting errors, which I can't resolve and the code is from the boost serialization tutorial, so I don't think that it's wrong. I'm using the NetBeans 8.0.2 IDE and the Boost Library Version 1.58.0.
The code:
#include <fstream>
// include headers that implement a archive in simple text format
//#include <boost/archive/text_oarchive.hpp>
//#include <boost/archive/text_iarchive.hpp>
#include "../boost/archive/text_oarchive.hpp"
#include "../boost/archive/text_iarchive.hpp"
/////////////////////////////////////////////////////////////
// gps coordinate
//
// illustrates serialization for a simple type
//
class gps_position
{
private:
friend class boost::serialization::access;
// When the class Archive corresponds to an output archive, the
// & operator is defined similar to <<. Likewise, when the class Archive
// is a type of input archive the & operator is defined similar to >>.
template<class Archive>
void serialize(Archive & ar, const unsigned int version)
{
ar & degrees;
ar & minutes;
ar & seconds;
}
int degrees;
int minutes;
float seconds;
public:
gps_position(){};
gps_position(int d, int m, float s) :
degrees(d), minutes(m), seconds(s)
{}
};
int main() {
// create and open a character archive for output
std::ofstream ofs("filename");
// create class instance
const gps_position g(35, 59, 24.567f);
// save data to archive
{
boost::archive::text_oarchive oa(ofs);
// write class instance to archive
oa << g;
// archive and stream closed when destructors are called
}
// ... some time later restore the class instance to its orginal state
gps_position newg;
{
// create and open an archive for input
std::ifstream ifs("filename");
boost::archive::text_iarchive ia(ifs);
// read class state from archive
ia >> newg;
// archive and stream closed when destructors are called
}
return 0;
}
And now the error messages:
g++ -o dist/Debug/GNU-MacOSX/boost_serialization build/Debug/GNU-MacOSX/main.o
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<gps_position>::extended_type_info_typeid() in main.o
"boost::serialization::typeid_system::extended_type_info_typeid_0::type_unregister()", referenced from:
boost::serialization::extended_type_info_typeid<gps_position>::~extended_type_info_typeid() in main.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<gps_position>::extended_type_info_typeid() in main.o
"boost::serialization::typeid_system::extended_type_info_typeid_0::~extended_type_info_typeid_0()", referenced from:
boost::serialization::extended_type_info_typeid<gps_position>::~extended_type_info_typeid() in main.o
boost::serialization::extended_type_info_typeid<gps_position>::extended_type_info_typeid() in main.o
"boost::archive::archive_exception::archive_exception(boost::archive::archive_exception::exception_code, char const*, char const*)", referenced from:
void boost::archive::basic_text_iprimitive<std::__1::basic_istream<char, std::__1::char_traits<char> > >::load<float>(float&) in main.o
void boost::archive::basic_text_iprimitive<std::__1::basic_istream<char, std::__1::char_traits<char> > >::load<int>(int&) in main.o
void boost::archive::basic_text_oprimitive<std::__1::basic_ostream<char, std::__1::char_traits<char> > >::save_impl<float>(float const&, mpl_::bool_<true>&) in main.o
void boost::archive::basic_text_oprimitive<std::__1::basic_ostream<char, std::__1::char_traits<char> > >::save_impl<int>(int const&, mpl_::bool_<false>&) in main.o
void boost::archive::basic_text_iprimitive<std::__1::basic_istream<char, std::__1::char_traits<char> > >::load<boost::archive::tracking_type>(boost::archive::tracking_type&) in main.o
void boost::archive::basic_text_iprimitive<std::__1::basic_istream<char, std::__1::char_traits<char> > >::load<boost::archive::class_id_type>(boost::archive::class_id_type&) in main.o
void boost::archive::basic_text_iprimitive<std::__1::basic_istream<char, std::__1::char_traits<char> > >::load<boost::archive::object_id_type>(boost::archive::object_id_type&) in main.o
...
"boost::archive::archive_exception::~archive_exception()", referenced from:
void boost::archive::basic_text_iprimitive<std::__1::basic_istream<char, std::__1::char_traits<char> > >::load<float>(float&) in main.o
void boost::serialization::throw_exception<boost::archive::archive_exception>(boost::archive::archive_exception const&) in main.o
void boost::archive::basic_text_iprimitive<std::__1::basic_istream<char, std::__1::char_traits<char> > >::load<int>(int&) in main.o
void boost::archive::basic_text_oprimitive<std::__1::basic_ostream<char, std::__1::char_traits<char> > >::save_impl<float>(float const&, mpl_::bool_<true>&) in main.o
void boost::archive::basic_text_oprimitive<std::__1::basic_ostream<char, std::__1::char_traits<char> > >::save_impl<int>(int const&, mpl_::bool_<false>&) in main.o
void boost::archive::basic_text_iprimitive<std::__1::basic_istream<char, std::__1::char_traits<char> > >::load<boost::archive::tracking_type>(boost::archive::tracking_type&) in main.o
void boost::archive::basic_text_iprimitive<std::__1::basic_istream<char, std::__1::char_traits<char> > >::load<boost::archive::class_id_type>(boost::archive::class_id_type&) in main.o
...
"boost::archive::text_iarchive_impl<boost::archive::text_iarchive>::load_override(boost::archive::class_name_type&, int)", referenced from:
boost::archive::text_iarchive& boost::archive::detail::interface_iarchive<boost::archive::text_iarchive>::operator>><boost::archive::class_name_type>(boost::archive::class_name_type&) in main.o
"boost::archive::text_iarchive_impl<boost::archive::text_iarchive>::text_iarchive_impl(std::__1::basic_istream<char, std::__1::char_traits<char> >&, unsigned int)", referenced from:
boost::archive::text_iarchive::text_iarchive(std::__1::basic_istream<char, std::__1::char_traits<char> >&, unsigned int) in main.o
"boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
void boost::archive::save_access::save_primitive<boost::archive::text_oarchive, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(boost::archive::text_oarchive&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in main.o
"boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::text_oarchive_impl(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, unsigned int)", referenced from:
boost::archive::text_oarchive::text_oarchive(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, unsigned int) in main.o
"boost::archive::basic_text_oarchive<boost::archive::text_oarchive>::newtoken()", referenced from:
void boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save<float>(float const&) in main.o
void boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save<int>(int const&) in main.o
void boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save<boost::archive::tracking_type>(boost::archive::tracking_type const&) in main.o
void boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save<boost::archive::class_id_reference_type>(boost::archive::class_id_reference_type const&) in main.o
void boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save<boost::archive::class_id_type>(boost::archive::class_id_type const&) in main.o
void boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save<boost::archive::object_reference_type>(boost::archive::object_reference_type const&) in main.o
void boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save<boost::archive::object_id_type>(boost::archive::object_id_type const&) in main.o
...
"boost::archive::basic_text_iprimitive<std::__1::basic_istream<char, std::__1::char_traits<char> > >::~basic_text_iprimitive()", referenced from:
boost::archive::text_iarchive_impl<boost::archive::text_iarchive>::~text_iarchive_impl() in main.o
"boost::archive::basic_text_oprimitive<std::__1::basic_ostream<char, std::__1::char_traits<char> > >::~basic_text_oprimitive()", referenced from:
boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::~text_oarchive_impl() in main.o
"boost::archive::detail::basic_iarchive::load_object(void*, boost::archive::detail::basic_iserializer const&)", referenced from:
void boost::archive::detail::load_non_pointer_type<boost::archive::text_iarchive>::load_standard::invoke<gps_position>(boost::archive::text_iarchive&, gps_position const&) in main.o
"boost::archive::detail::basic_iarchive::~basic_iarchive()", referenced from:
boost::archive::detail::common_iarchive<boost::archive::text_iarchive>::~common_iarchive() in main.o
"boost::archive::detail::basic_oarchive::save_object(void const*, boost::archive::detail::basic_oserializer const&)", referenced from:
void boost::archive::detail::save_non_pointer_type<boost::archive::text_oarchive>::save_standard::invoke<gps_position>(boost::archive::text_oarchive&, gps_position const&) in main.o
"boost::archive::detail::basic_oarchive::end_preamble()", referenced from:
void boost::archive::save_access::save_primitive<boost::archive::text_oarchive, float>(boost::archive::text_oarchive&, float const&) in main.o
void boost::archive::save_access::save_primitive<boost::archive::text_oarchive, int>(boost::archive::text_oarchive&, int const&) in main.o
void boost::archive::save_access::save_primitive<boost::archive::text_oarchive, boost::archive::tracking_type>(boost::archive::text_oarchive&, boost::archive::tracking_type const&) in main.o
void boost::archive::save_access::save_primitive<boost::archive::text_oarchive, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(boost::archive::text_oarchive&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in main.o
void boost::archive::save_access::save_primitive<boost::archive::text_oarchive, boost::archive::class_id_reference_type>(boost::archive::text_oarchive&, boost::archive::class_id_reference_type const&) in main.o
void boost::archive::save_access::save_primitive<boost::archive::text_oarchive, boost::archive::class_id_type>(boost::archive::text_oarchive&, boost::archive::class_id_type const&) in main.o
void boost::archive::save_access::save_primitive<boost::archive::text_oarchive, boost::archive::object_reference_type>(boost::archive::text_oarchive&, boost::archive::object_reference_type const&) in main.o
...
"boost::archive::detail::basic_oarchive::~basic_oarchive()", referenced from:
boost::archive::detail::common_oarchive<boost::archive::text_oarchive>::~common_oarchive() in main.o
"boost::archive::detail::basic_iserializer::basic_iserializer(boost::serialization::extended_type_info const&)", referenced from:
boost::archive::detail::iserializer<boost::archive::text_iarchive, gps_position>::iserializer() in main.o
"boost::archive::detail::basic_iserializer::~basic_iserializer()", referenced from:
boost::archive::detail::iserializer<boost::archive::text_iarchive, gps_position>::~iserializer() in main.o
"boost::archive::detail::basic_oserializer::basic_oserializer(boost::serialization::extended_type_info const&)", referenced from:
boost::archive::detail::oserializer<boost::archive::text_oarchive, gps_position>::oserializer() in main.o
"boost::archive::detail::basic_oserializer::~basic_oserializer()", referenced from:
boost::archive::detail::oserializer<boost::archive::text_oarchive, gps_position>::~oserializer() in main.o
"boost::serialization::typeid_system::extended_type_info_typeid_0::is_less_than(boost::serialization::extended_type_info const&) const", referenced from:
vtable for boost::serialization::detail::singleton_wrapper<boost::serialization::extended_type_info_typeid<gps_position> > in main.o
vtable for boost::serialization::extended_type_info_typeid<gps_position> in main.o
"boost::serialization::typeid_system::extended_type_info_typeid_0::is_equal(boost::serialization::extended_type_info const&) const", referenced from:
vtable for boost::serialization::detail::singleton_wrapper<boost::serialization::extended_type_info_typeid<gps_position> > in main.o
vtable for boost::serialization::extended_type_info_typeid<gps_position> in main.o
"boost::serialization::extended_type_info::key_register() const", referenced from:
boost::serialization::extended_type_info_typeid<gps_position>::extended_type_info_typeid() in main.o
"boost::serialization::extended_type_info::key_unregister() const", referenced from:
boost::serialization::extended_type_info_typeid<gps_position>::~extended_type_info_typeid() in main.o
"typeinfo for boost::serialization::typeid_system::extended_type_info_typeid_0", referenced from:
typeinfo for boost::serialization::extended_type_info_typeid<gps_position> in main.o
"typeinfo for boost::archive::archive_exception", referenced from:
void boost::serialization::throw_exception<boost::archive::archive_exception>(boost::archive::archive_exception const&) in main.o
"typeinfo for boost::archive::detail::basic_iarchive", referenced from:
boost::archive::text_iarchive& boost::serialization::smart_cast_impl::reference<boost::archive::text_iarchive&>::polymorphic::cross::cast<boost::archive::detail::basic_iarchive>(boost::archive::detail::basic_iarchive&) in main.o
typeinfo for boost::archive::detail::common_iarchive<boost::archive::text_iarchive> in main.o
"typeinfo for boost::archive::detail::basic_oarchive", referenced from:
boost::archive::text_oarchive& boost::serialization::smart_cast_impl::reference<boost::archive::text_oarchive&>::polymorphic::cross::cast<boost::archive::detail::basic_oarchive>(boost::archive::detail::basic_oarchive&) in main.o
typeinfo for boost::archive::detail::common_oarchive<boost::archive::text_oarchive> in main.o
"typeinfo for boost::archive::detail::basic_iserializer", referenced from:
typeinfo for boost::archive::detail::iserializer<boost::archive::text_iarchive, gps_position> in main.o
"typeinfo for boost::archive::detail::basic_oserializer", referenced from:
typeinfo for boost::archive::detail::oserializer<boost::archive::text_oarchive, gps_position> in main.o
"vtable for boost::archive::archive_exception", referenced from:
boost::archive::archive_exception::archive_exception(boost::archive::archive_exception const&) in main.o
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
You need to link against libboost_serialization:
g++ main.cpp -lboost_serialization

Boost Log 1.54 on Mac OS and QtCreator (G++)

How can one use logging library from Boost on version 1.54 ? (I'm using QtCreator and have successfully used boost/filesystem)
I read that the logging lib is now part of Boost, but I can't make it work on MacOs:
My .pro file:
#-------------------------------------------------
#
# Project created by QtCreator 2013-10-30T14:34:26
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = Fottopic
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp \
configwindow.cpp \
windowmanager.cpp
HEADERS += mainwindow.h \
configwindow.h \
windowmanager.h
INCLUDEPATH += /usr/local/Cellar/boost/1.54.0/include
QMAKE_LIBDIR += /usr/local/Cellar/boost/1.54.0/lib
LIBS += -lboost_system\
-lboost_filesystem\
-lboost_log\
-lboost_log_setup
Output when building:
Undefined symbols for architecture x86_64:
"boost::log::v2s_mt_posix::sinks::text_file_backend::~text_file_backend()", referenced from:
boost::detail::sp_ms_deleter<boost::log::v2s_mt_posix::sinks::text_file_backend>::destroy() in main.o
"boost::log::v2s_mt_posix::sinks::text_file_backend::construct(boost::filesystem::path const&, std::_Ios_Openmode, unsigned long, boost::log::v2s_mt_posix::aux::light_function<bool ()()> const&, bool)", referenced from:
void boost::log::v2s_mt_posix::sinks::text_file_backend::construct<boost::parameter::aux::tagged_argument<boost::log::v2s_mt_posix::keywords::tag::file_name, char const [11]> >(boost::parameter::aux::tagged_argument<boost::log::v2s_mt_posix::keywords::tag::file_name, char const [11]> const&)in main.o
"boost::log::v2s_mt_posix::sinks::text_file_backend::flush()", referenced from:
void boost::log::v2s_mt_posix::sinks::basic_sink_frontend::flush_backend_impl<boost::mutex, boost::log::v2s_mt_posix::sinks::text_file_backend>(boost::mutex&, boost::log::v2s_mt_posix::sinks::text_file_backend&, mpl_::bool_<true>)in main.o
"boost::detail::get_tss_data(void const*)", referenced from:
boost::thread_specific_ptr<boost::log::v2s_mt_posix::sinks::basic_formatting_sink_frontend<char>::formatting_context>::get() constin main.o
"boost::detail::set_tss_data(void const*, boost::shared_ptr<boost::detail::tss_cleanup_function>, void*, bool)", referenced from:
boost::thread_specific_ptr<boost::log::v2s_mt_posix::sinks::basic_formatting_sink_frontend<char>::formatting_context>::reset(boost::log::v2s_mt_posix::sinks::basic_formatting_sink_frontend<char>::formatting_context*)in main.o
boost::thread_specific_ptr<boost::log::v2s_mt_posix::sinks::basic_formatting_sink_frontend<char>::formatting_context>::~thread_specific_ptr()in main.o
"boost::log::v2s_mt_posix::sinks::text_file_backend::consume(boost::log::v2s_mt_posix::record_view const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
void boost::log::v2s_mt_posix::sinks::basic_formatting_sink_frontend<char>::feed_record<boost::log::v2s_mt_posix::aux::fake_mutex, boost::log::v2s_mt_posix::sinks::text_file_backend>(boost::log::v2s_mt_posix::record_view const&, boost::log::v2s_mt_posix::aux::fake_mutex&, boost::log::v2s_mt_posix::sinks::text_file_backend&)in main.o
void boost::log::v2s_mt_posix::sinks::basic_formatting_sink_frontend<char>::feed_record<boost::mutex, boost::log::v2s_mt_posix::sinks::text_file_backend>(boost::log::v2s_mt_posix::record_view const&, boost::mutex&, boost::log::v2s_mt_posix::sinks::text_file_backend&)in main.o
"boost::log::v2s_mt_posix::aux::default_attribute_names::message()", referenced from:
boost::log::v2s_mt_posix::expressions::tag::message::get_name() in main.o
"boost::log::v2s_mt_posix::aux::code_convert(wchar_t const*, unsigned long, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::locale const&)", referenced from:
boost::log::v2s_mt_posix::basic_formatting_ostream<char, std::char_traits<char>, std::allocator<char> >& boost::log::v2s_mt_posix::basic_formatting_ostream<char, std::char_traits<char>, std::allocator<char> >::formatted_write<wchar_t>(wchar_t const*, long)in main.o
"boost::log::v2s_mt_posix::aux::once_block_sentry::enter_once_block() const", referenced from:
boost::log::v2s_mt_posix::aux::once_block_sentry::executed() constin main.o
"boost::log::v2s_mt_posix::aux::once_block_sentry::rollback()", referenced from:
boost::log::v2s_mt_posix::aux::once_block_sentry::~once_block_sentry()in main.o
"boost::log::v2s_mt_posix::aux::once_block_sentry::commit()", referenced from:
boost::array<std::pair<boost::log::v2s_mt_posix::type_info_wrapper, void*>, 2ul> const& boost::log::v2s_mt_posix::aux::type_sequence_dispatcher<boost::mpl::vector2<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > >::get_dispatching_map<boost::log::v2s_mt_posix::binder1st<boost::log::v2s_mt_posix::output_fun, boost::log::v2s_mt_posix::basic_formatting_ostream<char, std::char_traits<char>, std::allocator<char> >&> >()in main.o
"boost::log::v2s_mt_posix::attribute_value_set::find(boost::log::v2s_mt_posix::attribute_name) const", referenced from:
boost::log::v2s_mt_posix::visitation_result boost::log::v2s_mt_posix::value_visitor_invoker<boost::mpl::vector2<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >, boost::log::v2s_mt_posix::fallback_to_none>::operator()<boost::log::v2s_mt_posix::binder1st<boost::log::v2s_mt_posix::output_fun, boost::log::v2s_mt_posix::basic_formatting_ostream<char, std::char_traits<char>, std::allocator<char> >&> >(boost::log::v2s_mt_posix::attribute_name const&, boost::log::v2s_mt_posix::attribute_value_set const&, boost::log::v2s_mt_posix::binder1st<boost::log::v2s_mt_posix::output_fun, boost::log::v2s_mt_posix::basic_formatting_ostream<char, std::char_traits<char>, std::allocator<char> >&>) constin main.o
"boost::log::v2s_mt_posix::attribute_value_set::end() const", referenced from:
boost::log::v2s_mt_posix::visitation_result boost::log::v2s_mt_posix::value_visitor_invoker<boost::mpl::vector2<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >, boost::log::v2s_mt_posix::fallback_to_none>::operator()<boost::log::v2s_mt_posix::binder1st<boost::log::v2s_mt_posix::output_fun, boost::log::v2s_mt_posix::basic_formatting_ostream<char, std::char_traits<char>, std::allocator<char> >&> >(boost::log::v2s_mt_posix::attribute_name const&, boost::log::v2s_mt_posix::attribute_value_set const&, boost::log::v2s_mt_posix::binder1st<boost::log::v2s_mt_posix::output_fun, boost::log::v2s_mt_posix::basic_formatting_ostream<char, std::char_traits<char>, std::allocator<char> >&>) constin main.o
"boost::log::v2s_mt_posix::aux::attach_attribute_name_info(boost::exception&, boost::log::v2s_mt_posix::attribute_name const&)", referenced from:
boost::log::v2s_mt_posix::visitation_result boost::log::v2s_mt_posix::value_visitor_invoker<boost::mpl::vector2<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >, boost::log::v2s_mt_posix::fallback_to_none>::operator()<boost::log::v2s_mt_posix::binder1st<boost::log::v2s_mt_posix::output_fun, boost::log::v2s_mt_posix::basic_formatting_ostream<char, std::char_traits<char>, std::allocator<char> >&> >(boost::log::v2s_mt_posix::attribute_name const&, boost::log::v2s_mt_posix::attribute_value_set const&, boost::log::v2s_mt_posix::binder1st<boost::log::v2s_mt_posix::output_fun, boost::log::v2s_mt_posix::basic_formatting_ostream<char, std::char_traits<char>, std::allocator<char> >&>) constin main.o
"boost::log::v2s_mt_posix::sinks::text_file_backend::set_file_collector(boost::shared_ptr<boost::log::v2s_mt_posix::sinks::file::collector> const&)", referenced from:
boost::shared_ptr<boost::log::v2s_mt_posix::sinks::synchronous_sink<boost::log::v2s_mt_posix::sinks::text_file_backend> > boost::log::v2s_mt_posix::aux::add_file_log<boost::parameter::aux::tagged_argument<boost::log::v2s_mt_posix::keywords::tag::file_name, char const [11]> >(boost::parameter::aux::tagged_argument<boost::log::v2s_mt_posix::keywords::tag::file_name, char const [11]> const&)in main.o
"boost::log::v2s_mt_posix::sinks::text_file_backend::scan_for_files(boost::log::v2s_mt_posix::sinks::file::scan_method, bool)", referenced from:
boost::shared_ptr<boost::log::v2s_mt_posix::sinks::synchronous_sink<boost::log::v2s_mt_posix::sinks::text_file_backend> > boost::log::v2s_mt_posix::aux::add_file_log<boost::parameter::aux::tagged_argument<boost::log::v2s_mt_posix::keywords::tag::file_name, char const [11]> >(boost::parameter::aux::tagged_argument<boost::log::v2s_mt_posix::keywords::tag::file_name, char const [11]> const&)in main.o
"boost::log::v2s_mt_posix::core::get()", referenced from:
boost::shared_ptr<boost::log::v2s_mt_posix::sinks::synchronous_sink<boost::log::v2s_mt_posix::sinks::text_file_backend> > boost::log::v2s_mt_posix::aux::add_file_log<boost::parameter::aux::tagged_argument<boost::log::v2s_mt_posix::keywords::tag::file_name, char const [11]> >(boost::parameter::aux::tagged_argument<boost::log::v2s_mt_posix::keywords::tag::file_name, char const [11]> const&)in main.o
"boost::log::v2s_mt_posix::core::add_sink(boost::shared_ptr<boost::log::v2s_mt_posix::sinks::sink> const&)", referenced from:
boost::shared_ptr<boost::log::v2s_mt_posix::sinks::synchronous_sink<boost::log::v2s_mt_posix::sinks::text_file_backend> > boost::log::v2s_mt_posix::aux::add_file_log<boost::parameter::aux::tagged_argument<boost::log::v2s_mt_posix::keywords::tag::file_name, char const [11]> >(boost::parameter::aux::tagged_argument<boost::log::v2s_mt_posix::keywords::tag::file_name, char const [11]> const&)in main.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [Fottopic.app/Contents/MacOS/Fottopic] Error 1
17:48:19: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project Fottopic (kit: Desktop)
When executing step 'Make'

Compiling a cpp file that uses Opencv

So I have a .cpp file that uses OpenCV. I've been having some problems with linking the libraries but I think my Makefile is "better" now.
Makefile:
CC=g++
#CC=gcc
# compile flags
CFLAGS=-g -Wall
# OpenCV Related
prefix=/usr/local/opencv
OCVFLAGS=-I${prefix}/include/opencv -I${prefix}/include
OCVLIBS=-L${prefix}/lib -lopencv_core -lopencv_highgui -lopencv_imgproc -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_flann -lopencv_objdetect -lopencv_calib3d
PROGRAM=extractDescriptorsToFile
OBJECTS=$(PROGRAM).o
program: $(OBJECTS)
$(CC) $(OBJECTS) -o $(PROGRAM) $(OCVLIBS) -arch i386
$(PROGRAM).o: $(PROGRAM).cpp
$(CC) -c $(CFLAGS) $(OCVFLAGS) $(PROGRAM).cpp
clean:
rm -f *o
rm -f $(PROGRAM)
rm -f *~
However, when I "make", the .o file is generated but I get this error:
ld: warning: ignoring file extractDescriptorsToFile.o, file was built for unsupported file format which is not the architecture being linked (i386)
Undefined symbols for architecture i386:
"_main", referenced from:
start in crt1.10.6.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
make: *** [program] Error 1
This is a similar post " Precompiled headers and compiling universal objects on OSX " but I don't think its quite my problem?
Any help would be appreciated...?
I think this error is sometimes cause by not having a main() but my file does...
Removing "-arch i386" leaves me with:
Undefined symbols for architecture x86_64:
"cv::operator<<(cv::FileStorage&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
cv::operator<<(cv::FileStorage&, char const*)in extractDescriptorsToFile.o
extract(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, char**, cv::FileStorage&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in extractDescriptorsToFile.o
_main in extractDescriptorsToFile.o
"cv::Ptr<CvFileStorage>::delete_obj()", referenced from:
cv::Ptr<CvFileStorage>::release() in extractDescriptorsToFile.o
"cv::fastFree(void*)", referenced from:
cv::Ptr<CvFileStorage>::release() in extractDescriptorsToFile.o
cv::Ptr<cv::FeatureDetector>::release() in extractDescriptorsToFile.o
cv::Ptr<cv::DescriptorExtractor>::release() in extractDescriptorsToFile.o
cv::Mat::~Mat() in extractDescriptorsToFile.o
"cv::fastMalloc(unsigned long)", referenced from:
cv::Ptr<cv::FeatureDetector>::Ptr(cv::FeatureDetector*)in extractDescriptorsToFile.o
"cv::Mat::deallocate()", referenced from:
cv::Mat::release() in extractDescriptorsToFile.o
"cv::Mat::copySize(cv::Mat const&)", referenced from:
cv::Mat::operator=(cv::Mat const&)in extractDescriptorsToFile.o
"cv::Exception::Exception(int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)", referenced from:
cv::FileStorage& cv::operator<< <cv::Mat>(cv::FileStorage&, cv::Mat const&)in extractDescriptorsToFile.o
"cv::error(cv::Exception const&)", referenced from:
cv::FileStorage& cv::operator<< <cv::Mat>(cv::FileStorage&, cv::Mat const&)in extractDescriptorsToFile.o
"cv::Exception::~Exception()", referenced from:
cv::FileStorage& cv::operator<< <cv::Mat>(cv::FileStorage&, cv::Mat const&)in extractDescriptorsToFile.o
"cv::write(cv::FileStorage&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::Mat const&)", referenced from:
cv::FileStorage& cv::operator<< <cv::Mat>(cv::FileStorage&, cv::Mat const&)in extractDescriptorsToFile.o
"cv::_OutputArray::_OutputArray(cv::Mat&)", referenced from:
resizeImage(cv::Mat const&, int)in extractDescriptorsToFile.o
"cv::_InputArray::_InputArray(cv::Mat const&)", referenced from:
resizeImage(cv::Mat const&, int)in extractDescriptorsToFile.o
"cv::resize(cv::_InputArray const&, cv::_OutputArray const&, cv::Size_<int>, double, double, int)", referenced from:
resizeImage(cv::Mat const&, int)in extractDescriptorsToFile.o
"cv::OrbFeatureDetector::OrbFeatureDetector(unsigned long, cv::ORB::CommonParams)", referenced from:
extract(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, char**, cv::FileStorage&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in extractDescriptorsToFile.o
"cv::FeatureDetector::create(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
extract(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, char**, cv::FileStorage&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in extractDescriptorsToFile.o
"cv::DescriptorExtractor::create(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
extract(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, char**, cv::FileStorage&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in extractDescriptorsToFile.o
"cv::imread(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)", referenced from:
extract(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, char**, cv::FileStorage&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in extractDescriptorsToFile.o
"cv::FeatureDetector::detect(cv::Mat const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, cv::Mat const&) const", referenced from:
extract(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, char**, cv::FileStorage&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in extractDescriptorsToFile.o
"cv::DescriptorExtractor::compute(cv::Mat const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, cv::Mat&) const", referenced from:
extract(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, char**, cv::FileStorage&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in extractDescriptorsToFile.o
"cv::write(cv::FileStorage&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> > const&)", referenced from:
extract(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, char**, cv::FileStorage&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in extractDescriptorsToFile.o
"cv::FileStorage::FileStorage()", referenced from:
_main in extractDescriptorsToFile.o
"cv::FileStorage::FileStorage(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
_main in extractDescriptorsToFile.o
"cv::FileStorage::~FileStorage()", referenced from:
_main in extractDescriptorsToFile.o
"cv::FileStorage::isOpened() const", referenced from:
_main in extractDescriptorsToFile.o
"cv::FileStorage::release()", referenced from:
_main in extractDescriptorsToFile.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [program] Error 1
This is what I get when I add -arch i386 to both program and $(PROGRAM).o:
Undefined symbols for architecture i386:
"_gzputs", referenced from:
icvPuts(CvFileStorage*, char const*)in libopencv_core.a(persistence.o)
"_gzgets", referenced from:
icvGets(CvFileStorage*, char*, int)in libopencv_core.a(persistence.o)
"_gzeof", referenced from:
icvEof(CvFileStorage*) in libopencv_core.a(persistence.o)
"_gzclose", referenced from:
_cvReleaseFileStorage in libopencv_core.a(persistence.o)
_cvOpenFileStorage in libopencv_core.a(persistence.o)
"_gzopen", referenced from:
_cvOpenFileStorage in libopencv_core.a(persistence.o)
"_gzrewind", referenced from:
_cvOpenFileStorage in libopencv_core.a(persistence.o)
"cv::Mat::convertTo(cv::Mat&, int, double, double) const", referenced from:
cv::imencode(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::Mat const&, std::vector<unsigned char, std::allocator<unsigned char> >&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(loadsave.o)
cv::imwrite_(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::Mat const&, std::vector<int, std::allocator<int> > const&, bool)in libopencv_highgui.a(loadsave.o)
"cv::flip(cv::Mat const&, cv::Mat&, int)", referenced from:
_cvEncodeImage in libopencv_highgui.a(loadsave.o)
cv::imwrite_(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::Mat const&, std::vector<int, std::allocator<int> > const&, bool)in libopencv_highgui.a(loadsave.o)
"_jpeg_destroy_decompress", referenced from:
cv::JpegDecoder::close() in libopencv_highgui.a(grfmt_jpeg.o)
cv::JpegDecoder::readData(cv::Mat&) in libopencv_highgui.a(grfmt_jpeg.o)
cv::JpegDecoder::readHeader() in libopencv_highgui.a(grfmt_jpeg.o)
cv::JpegDecoder::~JpegDecoder()in libopencv_highgui.a(grfmt_jpeg.o)
cv::JpegDecoder::~JpegDecoder()in libopencv_highgui.a(grfmt_jpeg.o)
cv::JpegDecoder::~JpegDecoder()in libopencv_highgui.a(grfmt_jpeg.o)
"_jpeg_CreateCompress", referenced from:
cv::JpegEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_jpeg.o)
"_jpeg_std_error", referenced from:
cv::JpegEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_jpeg.o)
cv::JpegDecoder::readHeader() in libopencv_highgui.a(grfmt_jpeg.o)
"_jpeg_destroy_compress", referenced from:
cv::JpegEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_jpeg.o)
"_jpeg_set_defaults", referenced from:
cv::JpegEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_jpeg.o)
"_jpeg_set_quality", referenced from:
cv::JpegEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_jpeg.o)
"_jpeg_start_compress", referenced from:
cv::JpegEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_jpeg.o)
"_jpeg_write_scanlines", referenced from:
cv::JpegEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_jpeg.o)
"_jpeg_finish_compress", referenced from:
cv::JpegEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_jpeg.o)
"_jpeg_stdio_dest", referenced from:
cv::JpegEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_jpeg.o)
"_jpeg_start_decompress", referenced from:
cv::JpegDecoder::readData(cv::Mat&) in libopencv_highgui.a(grfmt_jpeg.o)
"_jpeg_read_scanlines", referenced from:
cv::JpegDecoder::readData(cv::Mat&) in libopencv_highgui.a(grfmt_jpeg.o)
"_jpeg_finish_decompress", referenced from:
cv::JpegDecoder::readData(cv::Mat&) in libopencv_highgui.a(grfmt_jpeg.o)
"_jpeg_alloc_huff_table", referenced from:
cv::JpegDecoder::readData(cv::Mat&) in libopencv_highgui.a(grfmt_jpeg.o)
"_jpeg_CreateDecompress", referenced from:
cv::JpegDecoder::readHeader() in libopencv_highgui.a(grfmt_jpeg.o)
"_jpeg_read_header", referenced from:
cv::JpegDecoder::readHeader() in libopencv_highgui.a(grfmt_jpeg.o)
"_jpeg_stdio_src", referenced from:
cv::JpegDecoder::readHeader() in libopencv_highgui.a(grfmt_jpeg.o)
"_jpeg_resync_to_restart", referenced from:
cv::jpeg_buffer_src(jpeg_decompress_struct*, cv::JpegSource*) in libopencv_highgui.a(grfmt_jpeg.o)
cv::JpegDecoder::readHeader() in libopencv_highgui.a(grfmt_jpeg.o)
"_jas_init", referenced from:
__static_initialization_and_destruction_0(int, int)in libopencv_highgui.a(grfmt_jpeg2000.o)
"_jas_cleanup", referenced from:
___tcf_0 in libopencv_highgui.a(grfmt_jpeg2000.o)
"_jas_matrix_create", referenced from:
cv::Jpeg2KEncoder::writeComponent16u(void*, cv::Mat const&)in libopencv_highgui.a(grfmt_jpeg2000.o)
cv::Jpeg2KEncoder::writeComponent8u(void*, cv::Mat const&)in libopencv_highgui.a(grfmt_jpeg2000.o)
cv::Jpeg2KDecoder::readData(cv::Mat&) in libopencv_highgui.a(grfmt_jpeg2000.o)
"_jas_image_writecmpt", referenced from:
cv::Jpeg2KEncoder::writeComponent16u(void*, cv::Mat const&)in libopencv_highgui.a(grfmt_jpeg2000.o)
cv::Jpeg2KEncoder::writeComponent8u(void*, cv::Mat const&)in libopencv_highgui.a(grfmt_jpeg2000.o)
"_jas_matrix_destroy", referenced from:
cv::Jpeg2KEncoder::writeComponent16u(void*, cv::Mat const&)in libopencv_highgui.a(grfmt_jpeg2000.o)
cv::Jpeg2KEncoder::writeComponent8u(void*, cv::Mat const&)in libopencv_highgui.a(grfmt_jpeg2000.o)
cv::Jpeg2KDecoder::readData(cv::Mat&) in libopencv_highgui.a(grfmt_jpeg2000.o)
"_jas_stream_close", referenced from:
cv::Jpeg2KDecoder::close() in libopencv_highgui.a(grfmt_jpeg2000.o)
cv::Jpeg2KEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_jpeg2000.o)
cv::Jpeg2KDecoder::readData(cv::Mat&) in libopencv_highgui.a(grfmt_jpeg2000.o)
cv::Jpeg2KDecoder::readHeader() in libopencv_highgui.a(grfmt_jpeg2000.o)
"_jas_image_destroy", referenced from:
cv::Jpeg2KDecoder::close() in libopencv_highgui.a(grfmt_jpeg2000.o)
cv::Jpeg2KEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_jpeg2000.o)
cv::Jpeg2KDecoder::readData(cv::Mat&) in libopencv_highgui.a(grfmt_jpeg2000.o)
cv::Jpeg2KDecoder::readHeader() in libopencv_highgui.a(grfmt_jpeg2000.o)
"_jas_image_create", referenced from:
cv::Jpeg2KEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_jpeg2000.o)
"_jas_stream_fopen", referenced from:
cv::Jpeg2KEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_jpeg2000.o)
cv::Jpeg2KDecoder::readHeader() in libopencv_highgui.a(grfmt_jpeg2000.o)
"_jas_image_strtofmt", referenced from:
cv::Jpeg2KEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_jpeg2000.o)
"_jas_image_encode", referenced from:
cv::Jpeg2KEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_jpeg2000.o)
"_jas_image_getcmptbytype", referenced from:
cv::Jpeg2KDecoder::readData(cv::Mat&) in libopencv_highgui.a(grfmt_jpeg2000.o)
"_jas_cmprof_createfromclrspc", referenced from:
cv::Jpeg2KDecoder::readData(cv::Mat&) in libopencv_highgui.a(grfmt_jpeg2000.o)
"_jas_image_chclrspc", referenced from:
cv::Jpeg2KDecoder::readData(cv::Mat&) in libopencv_highgui.a(grfmt_jpeg2000.o)
"_jas_cmprof_destroy", referenced from:
cv::Jpeg2KDecoder::readData(cv::Mat&) in libopencv_highgui.a(grfmt_jpeg2000.o)
"_jas_image_readcmpt", referenced from:
cv::Jpeg2KDecoder::readData(cv::Mat&) in libopencv_highgui.a(grfmt_jpeg2000.o)
"_jas_image_decode", referenced from:
cv::Jpeg2KDecoder::readHeader() in libopencv_highgui.a(grfmt_jpeg2000.o)
"_png_destroy_read_struct", referenced from:
cv::PngDecoder::close() in libopencv_highgui.a(grfmt_png.o)
cv::PngDecoder::readData(cv::Mat&) in libopencv_highgui.a(grfmt_png.o)
cv::PngDecoder::readHeader() in libopencv_highgui.a(grfmt_png.o)
cv::PngDecoder::~PngDecoder()in libopencv_highgui.a(grfmt_png.o)
cv::PngDecoder::~PngDecoder()in libopencv_highgui.a(grfmt_png.o)
cv::PngDecoder::~PngDecoder()in libopencv_highgui.a(grfmt_png.o)
"_png_create_write_struct", referenced from:
cv::PngEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_png.o)
"_png_create_info_struct", referenced from:
cv::PngEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_png.o)
cv::PngDecoder::readHeader() in libopencv_highgui.a(grfmt_png.o)
"_png_destroy_write_struct", referenced from:
cv::PngEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_png.o)
"_png_set_write_fn", referenced from:
cv::PngEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_png.o)
"_png_set_filter", referenced from:
cv::PngEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_png.o)
"_png_set_compression_level", referenced from:
cv::PngEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_png.o)
"_png_set_compression_strategy", referenced from:
cv::PngEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_png.o)
"_png_set_IHDR", referenced from:
cv::PngEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_png.o)
"_png_write_info", referenced from:
cv::PngEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_png.o)
"_png_set_bgr", referenced from:
cv::PngEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_png.o)
cv::PngDecoder::readData(cv::Mat&) in libopencv_highgui.a(grfmt_png.o)
"_png_write_image", referenced from:
cv::PngEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_png.o)
"_png_write_end", referenced from:
cv::PngEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_png.o)
"_png_set_compression_mem_level", referenced from:
cv::PngEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_png.o)
"_png_init_io", referenced from:
cv::PngEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_png.o)
cv::PngDecoder::readHeader() in libopencv_highgui.a(grfmt_png.o)
"_png_set_swap", referenced from:
cv::PngEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_png.o)
cv::PngDecoder::readData(cv::Mat&) in libopencv_highgui.a(grfmt_png.o)
"_png_set_strip_alpha", referenced from:
cv::PngDecoder::readData(cv::Mat&) in libopencv_highgui.a(grfmt_png.o)
"_png_read_update_info", referenced from:
cv::PngDecoder::readData(cv::Mat&) in libopencv_highgui.a(grfmt_png.o)
"_png_read_image", referenced from:
cv::PngDecoder::readData(cv::Mat&) in libopencv_highgui.a(grfmt_png.o)
"_png_read_end", referenced from:
cv::PngDecoder::readData(cv::Mat&) in libopencv_highgui.a(grfmt_png.o)
"_png_set_rgb_to_gray", referenced from:
cv::PngDecoder::readData(cv::Mat&) in libopencv_highgui.a(grfmt_png.o)
"_png_set_gray_to_rgb", referenced from:
cv::PngDecoder::readData(cv::Mat&) in libopencv_highgui.a(grfmt_png.o)
"_png_set_expand_gray_1_2_4_to_8", referenced from:
cv::PngDecoder::readData(cv::Mat&) in libopencv_highgui.a(grfmt_png.o)
"_png_set_palette_to_rgb", referenced from:
cv::PngDecoder::readData(cv::Mat&) in libopencv_highgui.a(grfmt_png.o)
"_png_set_strip_16", referenced from:
cv::PngDecoder::readData(cv::Mat&) in libopencv_highgui.a(grfmt_png.o)
"_png_create_read_struct", referenced from:
cv::PngDecoder::readHeader() in libopencv_highgui.a(grfmt_png.o)
"_png_set_read_fn", referenced from:
cv::PngDecoder::readHeader() in libopencv_highgui.a(grfmt_png.o)
"_png_read_info", referenced from:
cv::PngDecoder::readHeader() in libopencv_highgui.a(grfmt_png.o)
"_png_get_IHDR", referenced from:
cv::PngDecoder::readHeader() in libopencv_highgui.a(grfmt_png.o)
"_png_error", referenced from:
cv::PngDecoder::readDataFromBuf(void*, unsigned char*, unsigned long)in libopencv_highgui.a(grfmt_png.o)
"_TIFFClose", referenced from:
cv::TiffDecoder::close() in libopencv_highgui.a(grfmt_tiff.o)
cv::TiffDecoder::readData(cv::Mat&) in libopencv_highgui.a(grfmt_tiff.o)
cv::TiffDecoder::readHeader() in libopencv_highgui.a(grfmt_tiff.o)
cv::TiffDecoder::~TiffDecoder()in libopencv_highgui.a(grfmt_tiff.o)
cv::TiffDecoder::~TiffDecoder()in libopencv_highgui.a(grfmt_tiff.o)
cv::TiffDecoder::~TiffDecoder()in libopencv_highgui.a(grfmt_tiff.o)
"_TIFFIsTiled", referenced from:
cv::TiffDecoder::readData(cv::Mat&) in libopencv_highgui.a(grfmt_tiff.o)
"_TIFFGetField", referenced from:
cv::TiffDecoder::readData(cv::Mat&) in libopencv_highgui.a(grfmt_tiff.o)
cv::TiffDecoder::readHeader() in libopencv_highgui.a(grfmt_tiff.o)
"_TIFFReadEncodedStrip", referenced from:
cv::TiffDecoder::readData(cv::Mat&) in libopencv_highgui.a(grfmt_tiff.o)
"_TIFFReadRGBAStrip", referenced from:
cv::TiffDecoder::readData(cv::Mat&) in libopencv_highgui.a(grfmt_tiff.o)
"_TIFFReadEncodedTile", referenced from:
cv::TiffDecoder::readData(cv::Mat&) in libopencv_highgui.a(grfmt_tiff.o)
"_TIFFReadRGBATile", referenced from:
cv::TiffDecoder::readData(cv::Mat&) in libopencv_highgui.a(grfmt_tiff.o)
"_TIFFOpen", referenced from:
cv::TiffDecoder::readHeader() in libopencv_highgui.a(grfmt_tiff.o)
"_TIFFRGBAImageOK", referenced from:
cv::TiffDecoder::readHeader() in libopencv_highgui.a(grfmt_tiff.o)
"_TIFFSetErrorHandler", referenced from:
cv::TiffDecoder::TiffDecoder()in libopencv_highgui.a(grfmt_tiff.o)
cv::TiffDecoder::TiffDecoder()in libopencv_highgui.a(grfmt_tiff.o)
"_TIFFSetWarningHandler", referenced from:
cv::TiffDecoder::TiffDecoder()in libopencv_highgui.a(grfmt_tiff.o)
cv::TiffDecoder::TiffDecoder()in libopencv_highgui.a(grfmt_tiff.o)
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
make: *** [program] Error 1
What happens if you remove explicit architecture specification (" -arch i386 ") from line 19? I guess that might help.
EDIT
Well it seems to me that you have a 64-bit OS, and 32-bit OpenCV libraries.

Boost serialization: Linking to libraries

I want to serialize objects in my program using the Boost library. It is my first time using it and it is giving me some problems.
In my program I have implemented the "serialize" method and include the following:
#include <fstream>
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
Now when I build I get the following errors:
Undefined symbols for architecture x86_64:
"boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::text_oarchive_impl(std::basic_ostream<char, std::char_traits<char> >&, unsigned int)", referenced from:
boost::archive::text_oarchive::text_oarchive(std::basic_ostream<char, std::char_traits<char> >&, unsigned int)in Main.o
"boost::archive::detail::basic_oarchive::~basic_oarchive()", referenced from:
boost::archive::detail::common_oarchive<boost::archive::text_oarchive>::~common_oarchive()in Main.o
boost::archive::detail::common_oarchive<boost::archive::text_oarchive>::~common_oarchive()in Main.o
boost::archive::detail::common_oarchive<boost::archive::text_oarchive>::~common_oarchive()in Main.o
"boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::~basic_text_oprimitive()", referenced from:
boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::~text_oarchive_impl()in Main.o
boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::~text_oarchive_impl()in Main.o
boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::~text_oarchive_impl()in Main.o
"vtable for boost::archive::archive_exception", referenced from:
boost::archive::archive_exception::archive_exception(boost::archive::archive_exception const&)in Main.o
"typeinfo for boost::archive::archive_exception", referenced from:
void boost::serialization::throw_exception<boost::archive::archive_exception>(boost::archive::archive_exception const&)in Main.o
"boost::archive::archive_exception::~archive_exception()", referenced from:
void boost::serialization::throw_exception<boost::archive::archive_exception>(boost::archive::archive_exception const&)in Main.o
void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<boost::archive::tracking_type>(boost::archive::tracking_type const&)in Main.o
void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<boost::archive::object_reference_type>(boost::archive::object_reference_type const&)in Main.o
void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<boost::archive::object_id_type>(boost::archive::object_id_type const&)in Main.o
void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<unsigned int>(unsigned int const&)in Main.o
void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<boost::archive::class_id_reference_type>(boost::archive::class_id_reference_type const&)in Main.o
void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<boost::archive::class_id_type>(boost::archive::class_id_type const&)in Main.o
...
"boost::archive::archive_exception::archive_exception(boost::archive::archive_exception::exception_code, char const*, char const*)", referenced from:
void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<boost::archive::tracking_type>(boost::archive::tracking_type const&)in Main.o
void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<boost::archive::object_reference_type>(boost::archive::object_reference_type const&)in Main.o
void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<boost::archive::object_id_type>(boost::archive::object_id_type const&)in Main.o
void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<unsigned int>(unsigned int const&)in Main.o
void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<boost::archive::class_id_reference_type>(boost::archive::class_id_reference_type const&)in Main.o
void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<boost::archive::class_id_type>(boost::archive::class_id_type const&)in Main.o
"boost::archive::basic_text_oarchive<boost::archive::text_oarchive>::newtoken()", referenced from:
void boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save<boost::archive::tracking_type>(boost::archive::tracking_type const&)in Main.o
void boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save<boost::archive::object_reference_type>(boost::archive::object_reference_type const&)in Main.o
void boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save<boost::archive::object_id_type>(boost::archive::object_id_type const&)in Main.o
void boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save<unsigned int>(unsigned int const&)in Main.o
void boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save<boost::archive::class_id_reference_type>(boost::archive::class_id_reference_type const&)in Main.o
void boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save<boost::archive::class_id_type>(boost::archive::class_id_type const&)in Main.o
"boost::archive::detail::basic_oarchive::end_preamble()", referenced from:
void boost::archive::save_access::save_primitive<boost::archive::text_oarchive, boost::archive::tracking_type>(boost::archive::text_oarchive&, boost::archive::tracking_type const&)in Main.o
void boost::archive::save_access::save_primitive<boost::archive::text_oarchive, boost::archive::object_reference_type>(boost::archive::text_oarchive&, boost::archive::object_reference_type const&)in Main.o
void boost::archive::save_access::save_primitive<boost::archive::text_oarchive, boost::archive::object_id_type>(boost::archive::text_oarchive&, boost::archive::object_id_type const&)in Main.o
void boost::archive::save_access::save_primitive<boost::archive::text_oarchive, boost::archive::version_type>(boost::archive::text_oarchive&, boost::archive::version_type const&)in Main.o
void boost::archive::save_access::save_primitive<boost::archive::text_oarchive, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >(boost::archive::text_oarchive&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in Main.o
void boost::archive::save_access::save_primitive<boost::archive::text_oarchive, boost::archive::class_id_reference_type>(boost::archive::text_oarchive&, boost::archive::class_id_reference_type const&)in Main.o
void boost::archive::save_access::save_primitive<boost::archive::text_oarchive, boost::archive::class_id_type>(boost::archive::text_oarchive&, boost::archive::class_id_type const&)in Main.o
...
"boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
void boost::archive::save_access::save_primitive<boost::archive::text_oarchive, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >(boost::archive::text_oarchive&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in Main.o
"typeinfo for boost::archive::detail::basic_oarchive", referenced from:
typeinfo for boost::archive::detail::common_oarchive<boost::archive::text_oarchive>in Main.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [stable] Error 1
I am not sure if the problem is because of linking or if it has something to do with 64 bit and 32 bit architecture.
I have tried linking with:
-L/opt/local/lib/ -lboost_iostreams -lboost_serialization
But it does not seem to do any difference.
It looks like your boost library bundle is 32 bit only; you'll have to rebuild it adding 64 bit binaries, or set your main project to match the boost libraries.
Try setting your project to generate a 32 bit binary instead of 64 bit. In XCode 4.2, you'd use the Architecture section of the build settings in the project inspector.
In my case: It is because I used compiler gcc6 (or gcc5 has same issue). And my code used different compile flag with boost libraries. Detail explanation is in this link
If you can recompile all incompatible libs you use, do it with compiler option
-D_GLIBCXX_USE_CXX11_ABI=1
and then rebuild your project. If still can not link, add change project's makefile compiler option to 0.
-D_GLIBCXX_USE_CXX11_ABI=0