当前位置: 动力学知识库 > 问答 > 编程问答 >

c++ - Can I run binary compiled with C++11 on the platform which doesn't support it?

问题描述:

I have 2 similar (say linux) platforms A and B. A supports C++03 and C++11; however B supports only C++03 compiler.

I compile code (with C++03) on platform A and able to run its binary on B without any problem. Is this case true for C++11 also ? (It may work in my platform, but want to know in broader sense).

In other words, is C++11 limited till compilation only or it's also a framework enhancement (added with support for new libraries and threads)?

网友答案:

In general, yes, but there should be C++0X runtime libraries present on the target machine, or you should have the runtime statically linked into the executable.

网友答案:

Yes.

Once you have binaries or executable's they should work on any platform. That is the purpose of them in the first place.

网友答案:

Since C++, whatever version, compiles down to Assembly (and OS-API-calls if dynamically linked), sure can do, as long as the instruction set is supported by the platform (and the proper DLLs are present).

网友答案:

To contrast the Linux-specific answer:

Windows does not have the notion of "supported C++ platforms". It works the other way around: C++ compilers can target different Windows versions. The C++ runtime for VS2010 supports XP SP2 and later.

分享给朋友:
您可能感兴趣的文章:
随机阅读: