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

本文记录了一个关于在thinkvd开发过程中遇到的LNK2005错误的解决方案,详细介绍了如何通过调整lib文件的加载顺序来解决链接器报错的问题。

(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

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值