Runtime Issues While Mixing Libraries from Different Versions of Visual Studio

后端 未结 2 496
甜味超标
甜味超标 2021-01-06 04:41

I have encountered an unexpected Access Error while running a project I\'ve built using two different versions of Visual Studio. My general configuration is as follows:

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-06 05:13

    There is no guarantee of library binary compatibility between major versions of MSVC. STL code is mostly template code that gets expanded into your code. So you're static libraries probably have incompatible chunks of STL code inside of them.

    In general, this shouldn't be a problem, unless that STL code is part of the interface to the library. For example, if you pass iterators or a reference to a vector from one library to another, you're in trouble.

    The best solution is to build everything with the same version of the compiler. If you can't do that (e.g., if the one of the libraries is from a third-party), you're probably stuck.

提交回复
热议问题