Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 运行在同一台计算机上编译的程序时,GLIBCXX版本错误_C++_Cmake_Libstdc++ - Fatal编程技术网

C++ 运行在同一台计算机上编译的程序时,GLIBCXX版本错误

C++ 运行在同一台计算机上编译的程序时,GLIBCXX版本错误,c++,cmake,libstdc++,C++,Cmake,Libstdc++,我在同一台机器上编译、链接和运行的程序在尝试运行时,怎么可能出现GLIBCXX版本错误?有人知道吗 以下是我得到的错误: 0.01s$ build/test/gamgee_test build/test/gamgee_test: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by build/test/gamgee_test) build/test/gamgee_test:

我在同一台机器上编译、链接和运行的程序在尝试运行时,怎么可能出现GLIBCXX版本错误?有人知道吗

以下是我得到的错误:

0.01s$ build/test/gamgee_test
build/test/gamgee_test: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by build/test/gamgee_test)
build/test/gamgee_test: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.18' not found (required by build/test/gamgee_test)
包括构建和运行的完整输出(VERBOSE=1)如下所示:

这以前没有发生过,只是在我切换到cmake之后。同样的代码在Clang中运行良好(使用libstdc++的捆绑版本,因为我还没有在VM上安装libc++)。日志如下:


非常困惑。

运行时路径与编译路径不同。听起来您的系统上有多个版本的库。检查LD_LIBRARY_PATH env变量,并使用ldd调用可执行文件,查看它正在使用/试图使用哪些库。

如何检查运行时并编译库路径?我以为
ld--verbose | grep SEARCH
告诉我编译和运行时的搜索路径。你说得对,gcc 4.6中安装了第二个libstdc++。经过多次修改后,我通过从/usr/lib64链接它,用4.9.1 stdlibc++替换了它。这是我愚弄travis的唯一方法(因为我无法将ad/usr/lib64转换为ld.so.conf)。