Linking against boost barfs with 'undefined reference to `boost::system::get_system_category()'

我的梦境 提交于 2019-12-04 02:13:18

When statically linking the linker expects that libraries will come after the files containing references to them. You need to move your .o files before your -l flags. The idea is that files that come later 'fill in' references contained in earlier files -- since your .o files are last, the linker expects them to fill in any missing symbols in boost_system rather than vice versa. When you dynamically link, the order doesn't matter because it doesn't resolve a symbol until the first time it's used at runtime (and by that time it knows the full list of libraries to look for symbols in).

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