Boost Xcode C++ command line Undefined symbols for architecture x86_64 -
i have gotten boost work in test application following instructions here. need create command-line application generate licenses. i've inherited code , uses boost. think i've set correctly when try build receive undefined symbols architecture x86_64 error using boost.
i created command-line application:
i added path boost:
i tried change c++ standard library compiler:
here code referencing boost library:
#include <boost/date_time/posix_time/posix_time_io.hpp> namespace bg = boost::gregorian; namespace bp = boost::posix_time;
here errors:
undefined symbols architecture x86_64: "boost::program_options::to_internal(std::string const&)", referenced from: std::vector<std::string, std::allocator<std::string> > boost::program_options::to_internal<std::string>(std::vector<std::string, std::allocator<std::string> > const&) in main.o "boost::program_options::variables_map::variables_map()", referenced from: _main in main.o "boost::program_options::options_description::add_options()", referenced from: _main in main.o "boost::program_options::options_description::m_default_line_length", referenced from: _main in main.o "boost::program_options::options_description::options_description(std::string const&, unsigned int, unsigned int)", referenced from: _main in main.o "boost::program_options::options_description_easy_init::operator()(char const*, boost::program_options::value_semantic const*, char const*)", referenced from: _main in main.o "boost::program_options::options_description_easy_init::operator()(char const*, char const*)", referenced from: _main in main.o "boost::program_options::arg", referenced from: boost::program_options::typed_value<std::string, char>::name() const in main.o "boost::program_options::store(boost::program_options::basic_parsed_options<char> const&, boost::program_options::variables_map&, bool)", referenced from: _main in main.o "boost::program_options::detail::cmdline::set_additional_parser(boost::function1<std::pair<std::string, std::string>, std::string const&>)", referenced from: boost::program_options::basic_command_line_parser<char>::extra_parser(boost::function1<std::pair<std::string, std::string>, std::string const&>) in main.o "boost::program_options::detail::cmdline::set_options_description(boost::program_options::options_description const&)", referenced from: boost::program_options::basic_command_line_parser<char>::options(boost::program_options::options_description const&) in main.o "boost::program_options::detail::cmdline::get_canonical_option_prefix()", referenced from: boost::program_options::basic_command_line_parser<char>::run() in main.o "boost::program_options::detail::cmdline::run()", referenced from: boost::program_options::basic_command_line_parser<char>::run() in main.o "boost::program_options::detail::cmdline::style(int)", referenced from: boost::program_options::basic_command_line_parser<char>::style(int) in main.o "boost::program_options::detail::cmdline::cmdline(std::vector<std::string, std::allocator<std::string> > const&)", referenced from: boost::program_options::basic_command_line_parser<char>::basic_command_line_parser(int, char const* const*) in main.o "boost::program_options::notify(boost::program_options::variables_map&)", referenced from: _main in main.o "boost::program_options::validate(boost::any&, std::vector<std::string, std::allocator<std::string> > const&, std::string*, int)", referenced from: boost::program_options::typed_value<std::string, char>::xparse(boost::any&, std::vector<std::string, std::allocator<std::string> > const&) const in main.o "boost::program_options::operator<<(std::ostream&, boost::program_options::options_description const&)", referenced from: _main in main.o "boost::program_options::error_with_option_name::get_canonical_option_name() const", referenced from: boost::program_options::error_with_option_name::get_option_name() const in main.o "boost::program_options::value_semantic_codecvt_helper<char>::parse(boost::any&, std::vector<std::string, std::allocator<std::string> > const&, bool) const", referenced from: vtable boost::program_options::typed_value<std::string, char> in main.o "typeinfo boost::program_options::error_with_option_name", referenced from: typeinfo boost::program_options::required_option in main.o "typeinfo boost::program_options::value_semantic_codecvt_helper<char>", referenced from: typeinfo boost::program_options::typed_value<std::string, char> in main.o "vtable boost::program_options::variables_map", referenced from: boost::program_options::variables_map::~variables_map() in main.o note: missing vtable means first non-inline virtual member function has no definition. "vtable boost::program_options::value_semantic_codecvt_helper<char>", referenced from: boost::program_options::value_semantic_codecvt_helper<char>::value_semantic_codecvt_helper() in main.o note: missing vtable means first non-inline virtual member function has no definition. ld: symbol(s) not found architecture x86_64 clang: error: linker command failed exit code 1 (use -v see invocation)
has gotten command-line application using boost build? if yes, can please help?
thank you.
the problem may caused 2 different problems:
- you haven't linked library propertly:
in "build phases" tab, in "link binary libaries" add: libboost_program_options.a
- another problem how have compiled , linked boost library when installed library.
if want use libstdc++ should build boost this:
./bootstrap.sh ./b2 cxxflags="-stdlib=libstdc++" linkflags="-stdlib=libstdc++" ./b2 install --prefix=yourinstallationdirectory
and use libstdc++ in xcode.
Comments
Post a Comment