在具有旧gcc / glibc / libstdc ++的计算机上运行使用gcc 4.7编译的C ++ 11可执行文件的问题 [英] Issues of running C++11 executable compiled with gcc 4.7 on a computer with an older gcc / glibc / libstdc++

查看:167
本文介绍了在具有旧gcc / glibc / libstdc ++的计算机上运行使用gcc 4.7编译的C ++ 11可执行文件的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是生产环境中的C ++编译的新手
我想知道是否在使用gcc版本的计算机上运行用gcc4.7编译的C ++ 11可执行文件(在debian 6上)时是否存在任何问题,旧的glibc / libstdc ++。



谢谢

编辑:

我想在我的问题中添加更多细节(也许最好打开一个新问题?)

我需要用新的在Debian 7(对于gcc 4.7)中的C ++ 11中的libs


  • 并在debian 6上运行exe

  • 在fedora 18上(对于gcc 4.7)并在centos 6上运行exe



如何实现?

解决方案

它真的取决于系统,但一般来说,对于libc,
应该不是真正的问题,除非你正在使用一些特殊的
函数,这些函数最近才被添加。 libc设计的
目标之一是它始终保持兼容性。

libstdc ++是另一回事,我强烈推荐
静态链接它( -static-libstdc ++ )。

I am a newbie to C++ compilation in production environment I wonder if there are any issues in running a C++11 executable compiled with gcc4.7 ( on debian 6 ) on a computer with an older gcc version, an older glibc / libstdc++.

Thanks

EDIT :

I want to add more details to my question ( maybe it's better to open a new question ? )

I need to compile a legacy C++ code with new libs in C++11

  • on debian 7 ( for gcc 4.7 ) and run the exe on debian 6
  • on fedora 18 ( for gcc 4.7 ) and run the exe on centos 6

How to achieve this ?

解决方案

It really depends on the system, but in general, for libc, there shouldn't be any real problem, unless you're using some special functions that were only added very recently. One of the design goals of libc is that it remain compatible for all time.

libstdc++ is a different matter, and I would strongly recomment statically linking it (-static-libstdc++).

这篇关于在具有旧gcc / glibc / libstdc ++的计算机上运行使用gcc 4.7编译的C ++ 11可执行文件的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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