Compile with boost to use whatever boost version is available?

ぐ巨炮叔叔 提交于 2019-12-02 10:41:50

问题


I've compiled a Linux package on ubuntu 12.04 which uses boost and on this system i have boost 1.46. I tried to run the compiled release on another system and it complains that it can't find libboost_system.so.1.46.1. That system has boost 1.49 installed. How do I compile so that the program uses whatever version of boot exists instead of the specific version on the development machine.


回答1:


You cannot expect your program to work with a different version of the library.

The fact that there are /different/ versions implies that they're /not the same/.

As mentioned, either

  • statically link to your specific version, or
  • you can ship the shared libraries (as long as you put them in a app-specific location and make sure you find them at runtime). Incidentally, see the second example here: How to compile boost async_client.cpp for the relevant linker options to use a custom library (it assumes the same location is to be used at runtime (rpath)


来源:https://stackoverflow.com/questions/22314951/compile-with-boost-to-use-whatever-boost-version-is-available

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!