How do I build simple boost program on Mac OS (Lion) -
steps:
1. sudo port boost
boost file installed in /opt/local/boost, library files in /opt/local/lib
2. use xcode create c++ project
#include <iostream> #include <boost/asio.hpp> int main () { return 0; }
3. set xcode find out boost
in "build settings" -> "header_search_paths"
in both debug , release add path /opt/local/include
4. "build settings" -> "library_search_paths" --> add /opt/local/lib both debug , release.
5. build program , failed.
error messages,
undefined symbols architecture x86_64: "boost::system::generic_category()", referenced from: ___cxx_global_var_init1 in main.o ___cxx_global_var_init2 in main.o "boost::system::system_category()", referenced from: ___cxx_global_var_init3 in main.o boost::asio::error::get_system_category() in main.o "boost::asio::error::get_netdb_category()", referenced from: ___cxx_global_var_init5 in main.o <br> "boost::asio::error::get_addrinfo_category()", referenced from: ___cxx_global_var_init6 in main.o <br> "boost::asio::error::get_misc_category()", referenced from: ___cxx_global_var_init7 in main.o <br> ld: symbol(s) not found architecture x86_64 clang: error: linker command failed exit code 1 (use -v see invocation)
am wrong in procedure?
you need link boost.system
, should in /opt/local/lib/libboost_system
(with suffix, depends on how built boost)
add xcode project.
Comments
Post a Comment