C++ 之 解决类似 /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found 的问题

原因:链接的动态库版本高于机器上的版本。

  1. 升级机器的GCC版本
    https://itbilu.com/linux/management/NymXRUieg.html

(stackoverflow建议Use readelf -a and objdump -x to inspect ELF files in preference to strings.)
https://stackoverflow.com/questions/4133674/glibcxx-versions

  1. 编译时指定使用低版本的GCC,运行时指定库路径
    https://www.cnblogs.com/qiumingcheng/p/11207199.html

  2. 搜索链接了高版本动态库的函数,强制该函数链接低版本的动态库

https://blog.csdn.net/Mr_HHH/article/details/83104485?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase
附:
https://blog.csdn.net/nullzhou/article/details/51123435
https://blog.csdn.net/wangmingsuyang/article/details/80089984

  1. 静态链接
原文地址:https://www.cnblogs.com/dirge/p/12995647.html