[英]Link errors when trying to compile against an old STD library and windows SDK
I have an old project that is compiled in VS2005 (Sadly). 我有一个在VS2005中编译的旧项目(可悲)。 It has to remain in VS2005 so it can link properly to another process which has the VS2005 CRT,MFC, etc. 它必须保留在VS2005中,以便可以正确链接到具有VS2005 CRT,MFC等的另一个进程。
Now I need to compile this project in VS2015, using the old VS2005 toolset. 现在,我需要使用旧版VS2005工具集在VS2015中编译该项目。
I've changed the project's VC++ directories to the old folders for all the STD and Windows SDK headers/libs (Include directories, Reference Directories, Library Directories, Source Directories). 我已将项目的VC ++目录更改为所有STD和Windows SDK标头/库(包括目录,参考目录,库目录,源目录)的旧文件夹。
This trick used to work fine while working with VS2010, but on VS2015 I'm getting some weird link errors: 在使用VS2010时,该技巧曾经可以正常工作,但是在VS2015上,我遇到了一些奇怪的链接错误:
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$0
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)
Why is it looking for this inner implementation of the deleter ? 为什么要寻找该删除器的内部实现? Should it be getting the implementation from the headers? 是否应该从标题获取实现? Why would it work in VS2010 and not VS2015? 为什么在VS2010而不是VS2015中可以使用?
How can I fix this properly ? 如何正确解决此问题?
So, after reading a lot of breaking changes documentations i found a flag that can suppress these new c++14 delete
implementations here , under Placement new and delete . 所以,读了很多重大更改单证后,我发现,能够抑制这些新的C ++ 14级的标记delete
的实现在这里 , 放置在新的和删除 。
Adding the flag /Zc:sizedDealloc- removes the missing operator delete() implementations. 添加标志/ Zc:sizedDealloc-将删除缺少的运算符delete()实现。
Project properties -> Configuration Properties -> C/C++ -> Command Line -> /Zc:sizedDealloc- 项目属性->配置属性-> C / C ++->命令行-> / Zc:sizedDealloc-
you can revert to the old behavior by using the compiler option /Zc:sizedDealloc- . 您可以使用编译器选项/ 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. 如果使用此选项,则不存在两个参数的删除功能,并且不会与您的展示位置删除运算符产生冲突。
For the eh vector destructor iterator
error I've opened a separate question , and answered it there . 对于eh vector destructor iterator
错误,我打开了一个单独的问题 ,并在此处回答 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.