首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >devtoolset-7 stl_vector.h未定义对`std::__throw_out_of_range_fmt的引用(char const*,...)‘

devtoolset-7 stl_vector.h未定义对`std::__throw_out_of_range_fmt的引用(char const*,...)‘
EN

Stack Overflow用户
提问于 2019-06-26 16:12:16
回答 2查看 1.2K关注 0票数 2

我当前正在尝试在CentOS 7上编译我的程序,但发生了下面的错误。

它在ubuntu18.04上运行得很好,但不能在CentOS 7上运行。

代码语言:javascript
复制
db/obj-db.o: In function `std::vector<std::string, std::allocator<std::string> >::_M_range_check(unsigned long) const':
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/stl_vector.h:825: undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)'
db/obj-db.o: In function `std::vector<int, std::allocator<int> >::_M_range_check(unsigned long) const':
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/stl_vector.h:825: undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)'
../bin/x64/libUFMatcher.so: undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)@GLIBCXX_3.4.20'
../bin/x64/libUFMatcher.so: undefined reference to `__cxa_throw_bad_array_new_length@CXXABI_1.3.8'
collect2: error: ld returned 1 exit status
make: *** [Makefile:56: ../bin/x64/MatchingServer] Error 1
EN

回答 2

Stack Overflow用户

发布于 2021-05-10 23:48:18

Centos7有一个旧的gcc版本,可能是4.8.5。但现在很多库都需要更高的版本。您可以运行以下命令以使用更高的gcc版本

代码语言:javascript
复制
sudo yum update -y
sudo yum install centos-release-scl
sudo yum install devtoolset-8 # gcc 8 is part of this toolset
scl enable devtoolset-8 bash # make the gcc version be 8.3.1
票数 0
EN

Stack Overflow用户

发布于 2021-09-10 09:20:06

检查链接的目标(object/lib)是否使用相同版本的gcc编译。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56768173

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档