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?
相关问题
- Is shmid returned by shmget() unique across proces
- how to get running process information in java?
- Error building gcc 4.8.3 from source: libstdc++.so
- Why should we check WIFEXITED after wait in order
- Null-terminated string, opening file for reading
Specify
-Lpath/to/library/
to the linker.Just add
-static
to 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.