VS2010:error LNK2001: 无法解析的外部符号 "void __cdecl std::_Xlen(void)" (?_Xlen@std@@$$F

qingfy2007 2013-05-05 11:05:54
背景介绍:
本人手中有客户提供的源码,功能是用 ANSI C++ + WDk 实现对 USB 的枚举,读写等,但是由于客户编写的程序源码有些乱,又是控制台程序,公司希望改写程序,并将程序可视化。

我的做法:

1、新建 C++/CLI 窗体程序,根据要求规划出界面;

2、新建C++/CLI 类库,将 USB driver 部分封装成 usbdev.lib 文件,OK;

3、再次新建C++/CLI类库,使用 #pragmat comment 命令引入 usbde.lib,并同时添加其相应的头文件,在新的类库中,建立与usbdev.lib 中一对一的类,用于封装,编译 失败。



编译器报告错误如下:

警告 1 warning LNK4068: 未指定 /MACHINE;默认设置为 X86 J:\0503-桌面\OMAPFlash\usbdev\LINK
警告 2 warning LNK4221: 此对象文件未定义任何之前未定义的公共符号,因此任何耗用此库的链接操作都不会使用此文件 J:\0503-桌面\OMAPFlash\usbdev\.NETFramework,Version=v4.0.AssemblyAttributes.obj
警告 3 warning LNK4221: 此对象文件未定义任何之前未定义的公共符号,因此任何耗用此库的链接操作都不会使用此文件 J:\0503-桌面\OMAPFlash\usbdev\AssemblyInfo.obj
警告 4 warning LNK4049: 已导入本地定义的符号 ??_7SerialDrv@@6B@ (const SerialDrv::`vftable') J:\0503-桌面\OMAPFlash\UsbDriver\usbdev.lib(serialdriver.obj)
错误 5 error LNK2020: 无法解析的标记(0A0002ED) "void __cdecl std::_Xran(void)" (?_Xran@std@@$$FYAXXZ) J:\0503-桌面\OMAPFlash\UsbDriver\Stdafx.obj
错误 6 error LNK2028: 无法解析的标记(0A000054) "void __cdecl std::_Xran(void)" (?_Xran@std@@$$FYAXXZ),该标记在函数 "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::erase(unsigned int,unsigned int)" (?erase@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@$$FQAEAAV12@II@Z) 中被引用 J:\0503-桌面\OMAPFlash\UsbDriver\MgPortEnumerator.obj
错误 7 error LNK2028: 无法解析的标记(0A000252) "void __cdecl std::_Xran(void)" (?_Xran@std@@$$FYAXXZ),该标记在函数 "public: class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > & __thiscall std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> >::erase(unsigned int,unsigned int)" (?erase@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@$$FQAEAAV12@II@Z) 中被引用 J:\0503-桌面\OMAPFlash\UsbDriver\usbdev.lib(Stdafx.obj)
错误 8 error LNK2028: 无法解析的标记(0A0002F4) "void __cdecl std::_Xlen(void)" (?_Xlen@std@@$$FYAXXZ),该标记在函数 "[T2M] protected: virtual void __thiscall std::bad_exception::_Doraise(void)const " (__t2m@?_Doraise@bad_exception@std@@MBEXXZ) 中被引用 J:\0503-桌面\OMAPFlash\UsbDriver\Stdafx.obj
错误 9 error LNK2028: 无法解析的标记(0A000092) "void __cdecl std::_Xlen(void)" (?_Xlen@std@@$$FYAXXZ),该标记在函数 "private: bool __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::_Grow(unsigned int,bool)" (?_Grow@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@$$FAAE_NI_N@Z) 中被引用 J:\0503-桌面\OMAPFlash\UsbDriver\MgPortEnumerator.obj
错误 10 error LNK2028: 无法解析的标记(0A000259) "void __cdecl std::_Xlen(void)" (?_Xlen@std@@$$FYAXXZ),该标记在函数 "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::assign(char const *)" (?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@$$FQAEAAV12@PBD@Z) 中被引用 J:\0503-桌面\OMAPFlash\UsbDriver\usbdev.lib(Stdafx.obj)
错误 11 error LNK2019: 无法解析的外部符号 "void __cdecl std::_Xlen(void)" (?_Xlen@std@@$$FYAXXZ),该符号在函数 "private: bool __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::_Grow(unsigned int,bool)" (?_Grow@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@$$FAAE_NI_N@Z) 中被引用 J:\0503-桌面\OMAPFlash\UsbDriver\MgPortEnumerator.obj
错误 12 error LNK2001: 无法解析的外部符号 "void __cdecl std::_Xlen(void)" (?_Xlen@std@@$$FYAXXZ) J:\0503-桌面\OMAPFlash\UsbDriver\Stdafx.obj
错误 13 error LNK2001: 无法解析的外部符号 "void __cdecl std::_Xlen(void)" (?_Xlen@std@@$$FYAXXZ) J:\0503-桌面\OMAPFlash\UsbDriver\usbdev.lib(Stdafx.obj)
错误 14 error LNK2019: 无法解析的外部符号 "void __cdecl std::_Xran(void)" (?_Xran@std@@$$FYAXXZ),该符号在函数 "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::erase(unsigned int,unsigned int)" (?erase@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@$$FQAEAAV12@II@Z) 中被引用 J:\0503-桌面\OMAPFlash\UsbDriver\MgPortEnumerator.obj
错误 15 error LNK2001: 无法解析的外部符号 "void __cdecl std::_Xran(void)" (?_Xran@std@@$$FYAXXZ) J:\0503-桌面\OMAPFlash\UsbDriver\Stdafx.obj
错误 16 error LNK2001: 无法解析的外部符号 "void __cdecl std::_Xran(void)" (?_Xran@std@@$$FYAXXZ) J:\0503-桌面\OMAPFlash\UsbDriver\usbdev.lib(Stdafx.obj)
错误 17 error LNK2001: 无法解析的外部符号 __CorDllMain@12 J:\0503-桌面\OMAPFlash\UsbDriver\LINK
错误 18 error LNK1120: 9 个无法解析的外部命令 J:\0503-桌面\OMAPFlash\Release\UsbDriver.dll
...全文
1524 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
qingfy2007 2013-05-05
  • 打赏
  • 举报
回复
小弟还在 MSDN 论坛上发布过该问题. 地址:http://social.msdn.microsoft.com/Forums/zh-CN/wpfzhchs/thread/6858dcbe-7b09-483e-9924-643c9538b9b6 求高人救命啊,项目赶时间。
qingfy2007 2013-05-05
  • 打赏
  • 举报
回复
论坛上有人以前提问过相似的问题:http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/5ac28a31-3339-4db1-90f4-68edad360309 小弟没看明白,求指点。 最好给出解决办法,解决方向也行。 TKS!
qingfy2007 2013-05-05
  • 打赏
  • 举报
回复
综合所有的编译错误,大致分为以下几项: 1、 error LNK2001: 无法解析的外部符号 "void __cdecl std::_Xlen(void) 2、error LNK2019: 无法解析的外部符号 "void __cdecl std::_Xran(void)" (?_Xran@std@@$$FYAXXZ),该符号在函数 "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::erase(unsigned int,unsigned int)" (?erase@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@$$FQAEAAV12@II@Z) 中被引用 J:\0503-桌面\OMAPFlash\UsbDriver\MgPortEnumerator.obj 3、error LNK2028: 无法解析的标记(0A000092) "void __cdecl std::_Xlen(void)" (?_Xlen@std@@$$FYAXXZ),该标记在函数 "private: bool __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::_Grow(unsigned int,bool)" (?_Grow@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@$$FAAE_NI_N@Z) 中被引用 J:\0503-桌面\OMAPFlash\UsbDriver\MgPortEnumerator.obj 4、error LNK2001: 无法解析的外部符号 __CorDllMain@12 J:\0503-桌面\OMAPFlash\UsbDriver\LINK

7,540

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 VC.NET
社区管理员
  • VC.NET社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧