Link 尝试针对旧 STD 库和 windows SDK 进行编译时出现错误

Link errors when trying to compile against an old STD library and windows SDK

我有一个在 VS2005 中编译的旧项目(遗憾)。它必须保留在 VS2005 中,以便它可以 link 正确地连接到另一个具有 VS2005 CRT、MFC 等的进程。

现在我需要在 VS2015 中编译这个项目,使用旧的 VS2005 工具集。
我已将项目的 VC++ 目录更改为所有 STD 和 Windows SDK headers/libs 的旧文件夹(包括目录、参考目录、库目录、源目录)。

这个技巧过去在 VS2010 上工作得很好,但在 VS2015 上我遇到了一些奇怪的 link 错误:

1>Project1.obj : error LNK2019: unresolved external symbol "void __stdcall `eh vector destructor iterator'(void *,unsigned int,unsigned int,void (__thiscall*)(void *))" (??_M@YGXPAXIIP6EX0@Z@Z) referenced in function "public: virtual void * __thiscall PluginInterface::`vector deleting destructor'(unsigned int)" (??_EPluginInterface@@UAEPAXI@Z)
1>     1>
1>StdAfx.obj : error LNK2001: unresolved external symbol "void __stdcall `eh vector destructor iterator'(void *,unsigned int,unsigned int,void (__thiscall*)(void *))" (??_M@YGXPAXIIP6EX0@Z@Z)
1>     1>
1>Project1.obj : error LNK2019: unresolved external symbol "void __cdecl operator delete(void *,unsigned int)" (??3@YAXPAXI@Z) referenced in function __unwindfunclet$?getInstance@Project1@@SAPAV1@XZ[=12=]
1>     1>
1>Project1.obj : error LNK2019: unresolved external symbol "void __cdecl operator delete[](void *,unsigned int)" (??_V@YAXPAXI@Z) referenced in function "public: virtual void * __thiscall PluginInterface::`vector deleting destructor'(unsigned int)" (??_EPluginInterface@@UAEPAXI@Z)

它为什么要寻找这个删除器的内部实现?它应该从 headers 获取实现吗?为什么它适用于 VS2010 而不是 VS2015?

我该如何正确解决这个问题?

因此,在阅读了大量重大更改文档之后,我发现了一个可以抑制这些新的 c++14 delete 实现的标志 here,在 Placement new 和 delete 下.

添加标志 /Zc:sizedDealloc- 删除缺少的运算符 delete() 实现。
项目属性 -> 配置属性 -> C/C++ -> 命令行 -> /Zc:sizedDealloc-

you can revert to the old behavior by using the compiler option /Zc:sizedDealloc-. If you use this option, the two-argument delete functions don’t exist and won't cause a conflict with your placement delete operator.

对于 eh vector destructor iterator 错误,我 , and