Search code examples
c++visual-c++linker

Can C++ libraries compiled with VC10 (sp1) be linked by code compiled with VC11?


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.


Solution

  • 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+ [...]