I'd like to use the Boost library in my C++ code, so I've inputted the right include search path and the right library search path, then I added all the Boost library files in Xcode. When I build my code the compiler says that the build is successful. However, once I run the code, the console tells this:
Console:
dyld: Symbol not found: _PyBaseObject_Type
Referenced from: /usr/local/lib/libboost_python27.dylib
Expected in: flat namespace
in /usr/local/lib/libboost_python27.dylib
Program ended with exit code: 9
My code:
#include <iostream>
#include <boost/any.hpp>
int main()
{
std::cout << std::endl;
return 0;
}
Where is my mistake? Please help.
This error occurs when you don't add a package to your project the right way. The problem has resolved in my example by installing Boost via Homebrew. Installing the package the right way means that if you install it manually (e.g. downloading it from GitHub), you should install it on the right path. But I suggest always installing C++ packages via Homebrew.