linking to boost regex in gcc

自闭症网瘾萝莉.ら 提交于 2019-11-29 07:18:04

Either add libboost_regex-gcc-1_35.a to your list of object files in your link step or add -static -lboost_regex-gcc-1_35 to the same. Also be sure that you have an -I switch pointing to your boost includes directory in your compile step. If the libraries are outside the typical search path (/usr/lib on *nix), add that directory to your link command with -Wl,-L/path/to/boost/libs for g++ or simply -L/path/to/boost/libs on ld.

I also faced similar problems when using boost filesystem. Here's what I needed to do to get it to link statically.

Excerpt from My Original (problematic) Makefile: LIBS = -static -lboost_filesystem

Solution: LIBS = -Wl,-Bstatic -lboost_filesystem -lboost_system -Wl,-Bdynamic

You can view the complete Makefile from http://code.google.com/p/neptuner/source/browse/codebase/trunk/stratego/uboat/Makefile

Needed to add boost_system to make it link properly. Direct addition/specification of libboost*.a created more problems. Note the -Bdynamic is present to prevent static link of standard libraries.

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