boost中regex使用时出现的问题
2016-05-04 21:31
295 查看
在使用到boost库中的regex的so文件中,如果出现如下错误:
undefined symbol: _ZN5boost9re_detail14verify_optionsEjNS_15regex_constants12_match_flagsE
说明在生成so文件时缺少引用regex的源文件,此时需要在makefile中或者编译时加上regex的库,然后重新编译
如果在重新编译时出现如下编译错误
relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with
-fPIC
could
not read symbols: Bad value
此时说明引用的regex库在编译时并没有使用-fPIC选项,重新下载对应项目版本的boost库,最新的boost库下载地址:
https://sourceforge.net/projects/boost/files/boost/1.60.0/
下载完成后解压boost库,然后进入libs/regex/build目录
选择对应编译器的带有shared标识的makefile文件,如gcc-shared.mak
执行 make -f gcc-shared.mak
cd gcc/boost_regex-gcc-1_40_shared
ar cr target.a *.o
然后将target.a替换原来的regex.a库就可以了
如果原来是so文件,则用gcc/libboost_regex-gcc-1_40.so替换原来的regex.so(这个我没试,我原来的就是静态库)
undefined symbol: _ZN5boost9re_detail14verify_optionsEjNS_15regex_constants12_match_flagsE
说明在生成so文件时缺少引用regex的源文件,此时需要在makefile中或者编译时加上regex的库,然后重新编译
如果在重新编译时出现如下编译错误
relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with
-fPIC
could
not read symbols: Bad value
此时说明引用的regex库在编译时并没有使用-fPIC选项,重新下载对应项目版本的boost库,最新的boost库下载地址:
https://sourceforge.net/projects/boost/files/boost/1.60.0/
下载完成后解压boost库,然后进入libs/regex/build目录
选择对应编译器的带有shared标识的makefile文件,如gcc-shared.mak
执行 make -f gcc-shared.mak
cd gcc/boost_regex-gcc-1_40_shared
ar cr target.a *.o
然后将target.a替换原来的regex.a库就可以了
如果原来是so文件,则用gcc/libboost_regex-gcc-1_40.so替换原来的regex.so(这个我没试,我原来的就是静态库)
相关文章推荐
- boost相关小知识(长期顶置更新)
- C#正则表达式Regex类的常用匹配
- 详解C#正则表达式Regex常用匹配
- C#正则表达式Regex类用法实例分析
- 使用正则Regex来移除网页的EnableViewState实现思路及代码
- 正则表达式(regex)或操作符”|“使用易出现功能Bug
- C++ 0x regex实现关键OR敏感字过滤
- C++单元测试:boost.test
- boost asio学习笔记 [1] - 同步通讯
- boost_asio学习笔记[2] - 客户端异步通讯
- 正则转义
- boost::flat_map性能测试
- Ubuntu下如何安装boost?
- How to get a boost::shared_ptr from this
- boost::regex简单用法
- ext4 Ext.form.field的regex
- boost 库 enable_shared_from_this 实现原理分析
- boost bind使用指南
- 正则表达式小记
- 正则表达式 Mather类的使用