Just started learning which Luo Jianfeng's "Boost Library full development guide", there are some problems and solutions under Mac OS under boost.
Environment: OS Yosemite (10.10.3)
Xcode:version 6.3
boost:1.58.0
Operation Steps:
Download boost and unzip;
/bootstrap.sh./b2./B2 Install;
Configure in Xcode (console engineering), build setting Add header search Paths and library search Paths (Installation path for step 2), build phases in link Binary with Libraries add LIBBOOST_SYSTEM.A;
Test: Mian function in # include "Boost/asio.hpp", compile.
Error Dyld:library not loaded:libboost_system.dylib referenced from:/users/shaunyi/library/developer/xcode/ Deriveddata/learningboost-djvlfrwiebzlncahwbsrniqfduuu/build/products/debug/learningboost reason:image not found;
You can compile successfully after adding libboost_system.dylib, but the following error will occur when executing: dyld_fatal_error
Cause: Because the XCODE5 completely switched to LLVM and discarded gcc, the boost library compiled with the old version of GCC will have the error of the load library (Dylib/dlopen??? Not too clear why), so you have to recompile the library with LLVM, preferably compiled to static.
Solution:
Use the following command when compiling the Boost library:./bootstrap.sh toolset=clang;./b2 Toolset=clang--without-mpi cxxflags= "-arch i386-arch x86_64- fvisibility=hidden-fvisibility-inlines-hidden-std=c++11-stdlib=libc++-ftemplate-depth=512 "linkflags="-stdlib= Libc++ "link=static Stage Install
Mac OS Install boost