error LNK2005 error LNK2001工程配置错误问题。

(thinkvd开发日志)编译正常的工程,加了几个函数之后,突然出现:

1>------ Build started: Project: ppt_plugin, Configuration: Debug Win32 ------

1>Linking...

1>nafxcwd.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in LIBCMTD.lib(dllmain.obj)

1>nafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in LIBCMTD.lib(new.obj)

1>nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in LIBCMTD.lib(dbgdel.obj)

1>nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete[](void *)" (??_V@YAXPAX@Z) already defined in LIBCMTD.lib(delete2.obj)

1>   Creating library ../bin/plus_ppt.lib and object ../bin/plus_ppt.exp

1>plus_ppt.exp : warning LNK4070: /OUT:ppt_plugin.dll directive in .EXP differs from output filename '../bin/plus_ppt.dll'; ignoring directive

1>../bin/plus_ppt.dll : fatal error LNK1169: one or more multiply defined symbols found

在Link->input->Ignore lib加入nafxcwd.lib,又出现:

>Linking...

1>   Creating library ../bin/plus_ppt.lib and object ../bin/plus_ppt.exp

1>plus_ppt.exp : warning LNK4070: /OUT:ppt_plugin.dll directive in .EXP differs from output filename '../bin/plus_ppt.dll'; ignoring directive

1>PPTEventSink.obj : error LNK2001: unresolved external symbol __afxForceEXCLUDE

1>pptPlugin.obj : error LNK2001: unresolved external symbol __afxForceEXCLUDE

1>PPTEventSink.obj : error LNK2001: unresolved external symbol __afxForceUSRDLL

1>pptPlugin.obj : error LNK2001: unresolved external symbol __afxForceUSRDLL

1>pptPlugin.obj : error LNK2019: unresolved external symbol "public: __thiscall COleVariant::~COleVariant(void)" (??1COleVariant@@QAE@XZ) referenced in function "long __stdcall MsgWndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?MsgWndProc@@YGJPAUHWND__@@IIJ@Z)

1>pptPlugin.obj : error LNK2019: unresolved external symbol "public: __thiscall COleVariant::COleVariant(long,unsigned short)" (??0COleVariant@@QAE@JG@Z) referenced in function "long __stdcall MsgWndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?MsgWndProc@@YGJPAUHWND__@@IIJ@Z)

1>../bin/plus_ppt.dll : fatal error LNK1120: 4 unresolved externals

 

在release, debug版都出现过,反复折腾,偶尔也好了,为什么好了自己也不清楚。查了一下资料,有人说是lib的顺序问题

在linker->comman Line 最后加上nafxcwd.lib

小结一下:
1。在Link->input->Ignore lib加入nafxcwd.lib
2。 linker->comman Line 最后加上nafxcwd.lib

 

你可能感兴趣的:(error LNK2005 error LNK2001工程配置错误问题。)