libstdc ++ GLIBCXX版本错误 [英] libstdc++ GLIBCXX version errors

查看:161
本文介绍了libstdc ++ GLIBCXX版本错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用g ++在我的计算机中编译一个c ++程序并将可执行文件传输到我的大学服务器上时,我得到

when I compile a c++ program in my computer using g++ and transfer the executable to run it on my university server, I get

./main: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by ./main)
./main: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.14' not found (required by ./main)
./main: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by ./main)

程序在我的计算机上运行良好,我没有权限安装任何新软件我的大学服务器。

The program runs well on my computer, and I don't have privileges to install any new software on my university servers.

有什么帮助吗?
感谢

any help ? Thanks

推荐答案

似乎你在使用标准库作为共享库

It seems you are using the standard library as a shared library (default behaviour) when linking your program at home.

因此,不是真的链接库,你的链接器只是解析一些符号,并做另一个操作,同时延迟库的实际加载运行,

So rather than really "linking" the library, your linker just resolves some symbols and does another operation, while delaying the actual loading of the library to run-time.

当你在你的大学计算机上执行程序时,加载程序(程序实际上在内存中加载程序并抛出主线程)查找库程序需要并尝试加载它们(如果您感到好奇,请在linux中查找 LD_LIBRARY_PATH )。

When you execute your program at your university computer, the loader (the program which actually loads your program in memory and throws the main thread) looks for the libraries your program needs and tries to load them (look for LD_LIBRARY_PATH in linux if you feel curious).

是你在家里链接你的程序与stdlib的版本不一样的版本,你在大学里。

The problem here is that you are linking your program at home with a version of the stdlib that is not the same version as what you have at the university. So when the loader tries to find the library, it fails, and so your program cannot be run.

解决方案:

a)为了避免所有这些问题,使用静态链接而不是动态链接。我不知道这是否可能与stdlib,但我认为这是值得测试它(参见: http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html ,并查找-static标志)

a) To avoid all these problems use static linking instead of dynamic linking. I am not sure if this is possible with stdlib, but I think it is worth to test it (see: http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html and look for "-static" flag)

b)您可以尝试在您的大学计算机上编译程序,以便在那里使用该程序。

b) You can try to compile your program at your university computer so it will use the version there.

c)尝试知道在那里安装了哪个stdlib版本

c) Try to know which stdlib version is installed there and install the same version in your compiler machine.

d)您可以尝试将您的家庭版本的stdlib复制到您的应用程序所在的同一个文件夹。这通常是有效的,因为加载器倾向于在查找环境变量 LD_LIBRARY_PATH (linux)

d) You can try to copy your home version of stdlib to the same folder your application is. This usually works because the loader tends to search for shared libraries in the current application folder before looking in the path set in the environment variable LD_LIBRARY_PATH (linux)

希望有帮助。

PS:
这里你有一个漂亮的静态和共享/动态库介绍 http://www.network-theory.co.uk/docs/gccintro/gccintro_25。 html

此处( http://en.wikipedia.org/wiki/Library_%28computing%29 )一个不那么好,但更完整的库描述。

And here (http://en.wikipedia.org/wiki/Library_%28computing%29) a not so nice but more complete library description.

这篇关于libstdc ++ GLIBCXX版本错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆