我从这个链接下载了这个C ++项目:http://www.codeproject.com/Articles/9903/Calling-Managed-Code-from-Unmanaged-Code-and-vice
然后尝试使用Visual Studio 2010编译它,我遇到了一些问题:
Error 3 error LNK2028: unresolved token (0A00000F) "void __cdecl operator delete(void *)" (??3@$$FYAXPAX@Z) referenced in function "public: __clrcall Managed_Wrapper::Managed_Wrapper_Class::Managed_Wrapper_Class(void)" (??0Managed_Wrapper_Class@Managed_Wrapper@@$$FQ$AAM@XZ) C:\Users\310052290\Desktop\DemoProject\Managed_Wrapper\Managed_Wrapper.obj Managed_Wrapper
Error 4 error LNK2028: unresolved token (0A000010) "void * __cdecl operator new(unsigned int)" (??2@$$FYAPAXI@Z) referenced in function "public: __clrcall Managed_Wrapper::Managed_Wrapper_Class::Managed_Wrapper_Class(void)" (??0Managed_Wrapper_Class@Managed_Wrapper@@$$FQ$AAM@XZ) C:\Users\310052290\Desktop\DemoProject\Managed_Wrapper\Managed_Wrapper.obj Managed_Wrapper
Error 5 error LNK2001: unresolved external symbol "?.cctor@@$$FYMXXZ" (?.cctor@@$$FYMXXZ) C:\Users\310052290\Desktop\DemoProject\Managed_Wrapper\Stdafx.obj Managed_Wrapper
Error 6 error LNK2001: unresolved external symbol "?.cctor@@$$FYMXXZ" (?.cctor@@$$FYMXXZ) C:\Users\310052290\Desktop\DemoProject\Managed_Wrapper\Unmanaged.obj Managed_Wrapper
Error 7 error LNK2001: unresolved external symbol "?.cctor@@$$FYMXXZ" (?.cctor@@$$FYMXXZ) C:\Users\310052290\Desktop\DemoProject\Managed_Wrapper\Unmanaged.obj Managed_Wrapper
Error 8 error LNK2001: unresolved external symbol "?.cctor@@$$FYMXXZ" (?.cctor@@$$FYMXXZ) C:\Users\310052290\Desktop\DemoProject\Managed_Wrapper\AssemblyInfo.obj Managed_Wrapper
Error 9 error LNK2001: unresolved external symbol "?.cctor@@$$FYMXXZ" (?.cctor@@$$FYMXXZ) C:\Users\310052290\Desktop\DemoProject\Managed_Wrapper\AssemblyInfo.obj Managed_Wrapper
Error 10 error LNK2001: unresolved external symbol "?.cctor@@$$FYMXXZ" (?.cctor@@$$FYMXXZ) C:\Users\310052290\Desktop\DemoProject\Managed_Wrapper\Managed_Wrapper.obj Managed_Wrapper
Error 11 error LNK2001: unresolved external symbol "?.cctor@@$$FYMXXZ" (?.cctor@@$$FYMXXZ) C:\Users\310052290\Desktop\DemoProject\Managed_Wrapper\Managed_Wrapper.obj Managed_Wrapper
Error 12 error LNK2019: unresolved external symbol "void __cdecl operator delete(void *)" (??3@$$FYAXPAX@Z) referenced in function "public: __clrcall Managed_Wrapper::Managed_Wrapper_Class::Managed_Wrapper_Class(void)" (??0Managed_Wrapper_Class@Managed_Wrapper@@$$FQ$AAM@XZ) C:\Users\310052290\Desktop\DemoProject\Managed_Wrapper\Managed_Wrapper.obj Managed_Wrapper
Error 13 error LNK2019: unresolved external symbol "void * __cdecl operator new(unsigned int)" (??2@$$FYAPAXI@Z) referenced in function "public: __clrcall Managed_Wrapper::Managed_Wrapper_Class::Managed_Wrapper_Class(void)" (??0Managed_Wrapper_Class@Managed_Wrapper@@$$FQ$AAM@XZ) C:\Users\310052290\Desktop\DemoProject\Managed_Wrapper\Managed_Wrapper.obj Managed_Wrapper
Error 14 error LNK2001: unresolved external symbol __CorDllMain@12 C:\Users\310052290\Desktop\DemoProject\Managed_Wrapper\LINK Managed_Wrapper
Error 15 error LNK1120: 6 unresolved externals C:\Users\310052290\Desktop\DemoProject\Managed_VBdotNET\Release\Managed_Wrapper.dll Managed_Wrapper
如何解决在Visual Studio 2010中编译C ++项目的问题?
提前致谢。
答案 0 :(得分:4)
您应该从/Zl
- >中删除Configuration Properties
C/C++
- > All Options
- > Additional Options