问题:只导出getServerObjects @1,无错误,添加updateServiceObject后报错,
dll 的def文件如下:
1 LIBRARY "lbcd" 2 3 EXPORTS 4 getServerObjects @1 5 updateServiceObject @2
错误如下:
lbcd.def : warning LNK4022: cannot find unique match for symbol 'updateServiceObject'
1>lbcd.def : warning LNK4002: "void __stdcall updateServiceObject(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?updateServiceObject@@YGXV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@00@Z) defined in Debug\LBC.obj
1>lbcd.def : warning LNK4002: "public: virtual int __thiscall IceDelegateD::LB::LoadBalance::updateServiceObject(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > > const *)" (?updateServiceObject@LoadBalance@LB@IceDelegateD@@UAEHABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@00PBV?$map@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@U?$less@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@@std@@@2@@5@@Z) defined in Debug\Load_Balance.obj
1>lbcd.def : warning LNK4002: "public: virtual int __thiscall IceDelegateM::LB::LoadBalance::updateServiceObject(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > > const *)" (?updateServiceObject@LoadBalance@LB@IceDelegateM@@UAEHABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@00PBV?$map@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@U?$less@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@@std@@@2@@5@@Z) defined in Debug\Load_Balance.obj
1>lbcd.def : warning LNK4002: "private: int __thiscall IceProxy::LB::LoadBalance::updateServiceObject(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > > const *)" (?updateServiceObject@LoadBalance@LB@IceProxy@@AAEHABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@00PBV?$map@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@U?$less@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@@std@@@2@@5@@Z) defined in Debug\Load_Balance.obj
1>lbcd.def : warning LNK4002: "public: int __thiscall IceProxy::LB::LoadBalance::updateServiceObject(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?updateServiceObject@LoadBalance@LB@IceProxy@@QAEHABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@00@Z) defined in Debug\LBC.obj
1>lbcd.def : error LNK2001: unresolved external symbol updateServiceObject
原因:updateServiceObject函数与某个dll中的函数重名,我这里是与ICE库中某个函数重名。