使用VC10(sp1)编译的C ++库是否可以通过使用VC11编译的代码链接? [英] Can C++ libraries compiled with VC10 (sp1) be linked by code compiled with VC11?

查看:94
本文介绍了使用VC10(sp1)编译的C ++库是否可以通过使用VC11编译的代码链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我知道VC11目前只处于测试阶段,但我要求的是:


  1. 尝试使用vc10编译的关闭源(尽可能广泛使用)链接的经验

  2. 是/否vc11将能够链接到vc10库。

我在谈论C ++案例。

解决方案

您可能需要阅读此答案

对于静态链接,我认为您无法安全地链接使用VCx编写的C ++库和使用VCy编译的代码。例如,STL容器实现从版本变为版本(甚至在同一版本中,调试和发布模式之间也有变化,以及_HAS_ITERATOR_DEBUGGING等设置)。



引用VC ++ STL维护者


STL从来没有,也不会保证不同主要版本之间的二进制兼容性
。我们正在强制使用链接器
错误混合目标文件/静态库编译的
不同的主要版本都是VC10 + [...]



The question says it all.

I understand that VC11 is currently only in beta, but what I'm asking is:

  1. experience with trying to link with a closed source (widely used if possible) library compiled with vc10
  2. specifications from Microsoft saying explicitely if yes or no the vc11 will be able to link with vc10 libraries.

I'm talking about C++ case only.

解决方案

You may want to read this answer for the case of dynamic linking.

Regarding static linking, I think you can't safely link C++ libraries written with VCx with code compiled with VCy. For example, STL containers implementations change from version to version (and even within the same version, there are changes between debug and release mode, and settings like _HAS_ITERATOR_DEBUGGING, etc.).

Quoting VC++ STL maintainer:

The STL never has and never will guarantee binary compatibility between different major versions. We're enforcing this with linker errors when mixing object files/static libraries compiled with different major versions that are both VC10+ [...]

这篇关于使用VC10(sp1)编译的C ++库是否可以通过使用VC11编译的代码链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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