简体   繁体   English

尝试针对旧的STD库和Windows SDK进行编译时出现链接错误

[英]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.

相关问题 尝试在 MSYS2/MinGW-w64 上编译时,许多内部标准库编译错误 - Many internal std library compile errors when trying to compile on MSYS2/MinGW-w64 如何编译和链接cddlib库? - How to compile and link against cddlib library? Visual Studio编译std库中的错误 - Visual Studio Compile errors in std library 试图摆脱std :: bind编译错误 - Trying to get past std::bind compile errors 尝试在Windows的CLI中编译Qt应用程序时出现链接器错误 - Linker errors when trying to compile Qt application in the CLI on Windows 当符号明确存在于我链接的静态库中时,为什么会出现链接错误? - Why do I get link errors when the symbol is clearly present in the static library I link against? Windows中的Qt库链接错误 - Qt library link errors in Windows 尝试过渡到GTK3时,未在此范围内声明GTK_OBJECT(针对gtk + -3.0库进行编译) - GTK_OBJECT was not declared in this scope when trying to transition to GTK3 (compile against gtk+-3.0 library) 尝试将 Qt/MSVC 与外部动态库链接时,Windows 上的奇怪 CMake 行为 - Strange CMake behavior on Windows when attepmting to link the Qt/MSVC against the external dynamic library 尝试链接到DLL时无法解析的外部 - Unresolved external when trying to link against a dll
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM