I am using the Boost library in Linux, GCC. After installing and building the Boost, I found that programs using Regex and Thread use shared Boost libraries. For my purposes, I need static linking.
How can I change linking type? Should I rebuild the Boost, or maybe I can set linking type by defining some constant in my own projects or Boost configuration files?
I am using the Boost library in Linux, GCC. After installing and building the
Share
Just add
-staticto your build invocation. Here is a quick example session:Note how the static binary is 1.5mb as opposed to 216kb for the dynamically-linked variant.
All done on Debian testing with the default Boost packages.