创建DLL,无法解析新的,删除和新[]

时间:2017-09-11 13:44:55

标签: visual-c++ linker new-operator

使用“vault”库创建DLL。编译很好,但它有一个问题链接,因为VS2013无法解析new,new []和delete运算符。不使用预编译头。如果我使用预编译头文件,我需要在所有源文件中添加#include“stdafx.h”,即使我这样做,它仍然无法链接。我尝试在项目中添加new.cpp和new.h,但这也没用。请让我知道如何解决这个问题。这些是错误,

Error 53 error LNK1120: 3 unresolved externals
C:\Users\dwane\Documents\Visual Studio\Projects\newest - 2\Debug\projDLL.dll projDLL Error 2 error LNK2001: unresolved external symbol "void * __cdecl operator new(unsigned int,char const *,int)" (??2@YAPAXIPBDH@Z)
C:\Users\dwane\Documents\Visual Studio\Projects\newest - 2\vthreadsunit.obj projDLL Error 3 error LNK2001: unresolved external symbol "void * __cdecl operator new(unsigned int,char const *,int)" (??2@YAPAXIPBDH@Z)
C:\Users\dwane\Documents\Visual Studio\Projects\newest - 2\vunit.obj projDLL Error 4 error LNK2001: unresolved external symbol "void * __cdecl operator new(unsigned int,char const *,int)" (??2@YAPAXIPBDH@Z)
C:\Users\dwane\Documents\Visual Studio\Projects\newest - 2\vbentounit.obj projDLL . . .

打开详细说明: Starting pass 1 1> Processed /DEFAULTLIB:MSVCRT 1> Processed /DEFAULTLIB:OLDNAMES 1> Processed /DEFAULTLIB:msvcprtd 1> Processed /DEFAULTLIB:libboost_thread-vc120-mt-gd-1_61.lib 1> Processed /DEFAULTLIB:libboost_date_time-vc120-mt-gd-1_61.lib 1> Processed /DEFAULTLIB:libboost_system-vc120-mt-gd-1_61.lib 1> Processed /DEFAULTLIB:libboost_chrono-vc120-mt-gd-1_61.lib 1> Processed /DEFAULTLIB:ws2_32.lib 1> Processed /DEFAULTLIB:mswsock.lib 1> Processed /DEFAULTLIB:advapi32.lib 1> Processed /DEFAULTLIB:uuid.lib

在列出错误(上图)之前,它会说明以下几行:

1>  Unused libraries:
1>    C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\User32.lib
1>    C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib\OLDNAMES.lib
1>    C:\Users\anantra\Documents\Visual Studio\Projects\newest\boost\x86\libboost_date_time-vc120-mt-gd-1_61.lib
1>    C:\Users\anantra\Documents\Visual Studio\Projects\newest\boost\x86\libboost_chrono-vc120-mt-gd-1_61.lib
1>    C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\mswsock.lib


1>    C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\uuid.lib

0 个答案:

没有答案