C++ Boost: is it included by default in most Linux distros?
Is the C++ Boost library usually included by default o开发者_StackOverflow社区n most Linux distros?
Many distributions include boost in their official repositories, but do not provide it by default on a standard install (in other words, it's not installed by default, but is relatively easy to install).
On the other hand, presuming you're asking this because you're wondering if you can use boost in a project that you want to work on many distributions: most of boost's libraries are header only because they're templates, which means they get compiled into your project and it doesn't matter whether or not a distribution has them installed (same effect as statically linking).
For those parts of boost that aren't header only, you can statically link and still make a binary that will run on distros that don't come with boost.
Be aware that distros with Boost included may include a really old version of Boost. I've found that this can cause a lot of small issues.
For example, you'll find a whiz-bang class that's in boost v.latest and it's not in version v.included. If said whiz-bang class is 'headers only' you can work around this fairly easily. If said class involves a library the pain factor increases (existing binaries will want shared libraries of version v.included -- your code will want v.latest).
I'm sure all of these issues can be worked around, but they're probably more than you planned on getting into, so book some time in your schedule/sprint to deal with them.
精彩评论