Recently I started working with Boost on Windows for a project. It needs to be cross-platform so I also installed it on Mac. Unfortunately; whenever I add it to the Xcode project it gives me a big slew of linker-errors and conversion-warnings.
Example of one of the linker-errors:
Undefined symbols for architecture x86_64:
"boost::system::system_category()", referenced from: ___cxx_global_var_init2 in main.o boost::asio::error::get_system_category() in main.o boost::system::error_code::error_code() in main.o "boost::system::generic_category()", referenced from: ___cxx_global_var_init in main.o ___cxx_global_var_init1 in main.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
Example of one of the conversion-warnings:
In file included from /usr/local/Cellar/boost/1.57.0/include/boost/date_time/posix_time/posix_time_types.hpp:16: /usr/local/Cellar/boost/1.57.0/include/boost/date_time/posix_time/posix_time_duration.hpp:24:21: warning: implicit conversion loses integer precision: 'long' to 'hour_type' (aka 'int') [-Wshorten-64-to-32] time_duration(h,0,0)
I tried several installation methods and configuration methods but it still won't work.
These are my steps:
- Compile Boost or get a compiled version of Boost.
- Create an XCode project.
- Enter this sample code in the main class.
- Add the header and library paths to the Xcode project file.
- Build.
Compile options I have tried:
- Compiling from source using the official guide.
- Compiling from source using a few scripts I found here on Stackoverflow.
- Installing the brew package manager and downloading a package with binaries.
Configuration options I have tried:
- Setting the header search path to /usr/local/Cellar/boost/1.57.0/include or equivalents and setting the library search path to /usr/local/Cellar/boost/1.57.0/lib or the equivalents.
- Setting just the header search path but not the library path.
- Option 1 but recursive (causes more errors).
I would appreciate it a lot if someone could point me in the right direction. I think it's something Xcode related since all of the compiled versions give me the same errors.