首页 > 解决方案 > C++ 二进制兼容性真的在 VS 2015 和 VS 2019 之间有效吗?

问题描述

我在我的 vc++ 项目中使用 Google 测试库(基于 Visual Studio 2015 中的平台工具集 v140 构建),该项目还在 Visual Studio 2015 中的平台工具集 v140 中构建。到目前为止一切正常。

现在,当我将我的项目迁移到 Visual Studio 2019(到平台工具集 v142),但想使用基于 v140 构建的相同 Google 测试库时,我得到以下 google 测试库的链接错误。

错误 LNK2019 无法解析外部符号“public: __cdecl testing::Message::Message(void)” (??0Message@testing@@QEAA@XZ) 在函数“private: virtual void __cdecl VideoProbeGoogleTest::BlobAutoDetector_BlobCreateGrayImageInRegion_Test::TestBody(void )" (?TestBody@BlobAutoDetector_BlobCreateGrayImageInRegion_Test@VideoProbeGoogleTest@@EEAAXXZ) WAI_VideoProbeBlobTest

错误 LNK2019 未解析的外部符号“public: class std::basic_string,class std::allocator > __cdecl testing::Message::GetString(void)const” (?GetString@Message@testing@@QEBA?AV?$basic_string@DU ?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) 在函数“private: void __cdecl testing::AssertionResult::AppendMessage(class testing::Message const &)”中引用( ?AppendMessage@AssertionResult@testing@@AEAAXAEBVMessage@2@@Z))

但据微软称,他们提供了 Visual Studio 2015、2017 和 2019 版本之间的二进制兼容性。 https://docs.microsoft.com/en-us/cpp/porting/binary-compat-2015-2017?view=vs-2019

我在这里做错什么了吗?为什么兼容性在我的情况下不起作用?

标签: c++visual-c++visual-studio-2015visual-studio-2019binary-compatibility

解决方案


推荐阅读