linux - devtoolset-7 STL_vector.h 未定义对 `std::__thr

我目前正在尝试在 CentOS 7 上编译我的程序,但出现了以下错误。

它适用于 ubuntu 18.04,但不适用于 CentOS 7。

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

最佳答案

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

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

关于linux - devtoolset-7 STL_vector.h 未定义对 `std::__throw_out_of_range_fmt(char const*, ...)' 的引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56768173/

相关文章:

visual-studio-code - 寻找用于 i18n 资源包编辑的 visual studi

apache-kafka - 无法从客户端 session ID 读取其他数据

python - 如何修复将文件上传到 Google Cloud Storage 时的内存泄漏?

scala - 寻找第二个匹配隐式

python - 有没有办法在 Windows 上使用 gradle 编译 python proto

python - ipywidgets 与 Jupyter Lab 版本 1.0+ 兼容吗?

python - 删除谷歌驱动器文件时权限不足错误

hive - 如何禁用 Hive 表的事务?

google-chrome - Chrome 开发工具 : memory heap snapshot

azure - 运行管道测试时出现无效的按需测试运行运行 ID 0 错误