问题
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 ?
回答1:
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++
).
来源:https://stackoverflow.com/questions/17151227/issues-of-running-c11-executable-compiled-with-gcc-4-7-on-a-computer-with-an-o