急,在vc里使用stl的一个link错误

xsh525 2006-02-02 04:05:06
我的类
class Buttons
{

public:
Buttons(BYTE bVk,UINT uChar,UINT uFullChar,UINT uCtrl,DWORD fdwFlags,bool isEnable = true)
{
............
};
~Buttons() {};
bool IsNormalKey()
{return (!(m_fdwFlags & (F_STK|F_TOG|F_MODE|F_VVK)));};


BYTE m_bVk;
UINT m_uChar;
UINT m_uFullChar;
UINT m_uCtrl;
DWORD m_fdwFlags;
bool m_isEnable;
protected:
private:
};
为什么用
vector<Buttons>的时候(有包含<vector>和using namespace std),会有以下连接错误:

im.obj : error LNK2019: unresolved external symbol __CxxThrowException referenced in function "protected: void __cdecl std::vector<class Buttons,class std::allocator<class Buttons> >::_Xran(void)const " (?_Xran@?$vector@VButtons@@V?$allocator@VButto
ns@@@std@@@std@@IBAXXZ)

im.obj : error LNK2001: unresolved external symbol "public: __cdecl std::exception::exception(class std::exception const &)" (??0exception@std@@QAA@ABV01@@Z)
im.obj : error LNK2001: unresolved external symbol "const type_info::`vftable'" (??_7type_info@@6B@)

im.obj : error LNK2019: unresolved external symbol "public: __cdecl std::exception::exception(char const *)" (??0exception@std@@QAA@PBD@Z) referenced in function "public: __cdecl std::logic_error::logic_error(class std::basic_string<char,struct std:
:char_traits<char>,class std::allocator<char> > const &)" (??0logic_error@std@@QAA@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z)

im.obj : error LNK2019: unresolved external symbol "public: virtual __cdecl std::exception::~exception(void)" (??1exception@std@@UAA@XZ) referenced in function "public: virtual __cdecl std::logic_error::~logic_error(void)" (??1logic_error@std@@UAA@X
Z)

im.obj : error LNK2019: unresolved external symbol "void __cdecl std::_Xran(void)" (?_Xran@std@@YAXXZ) referenced in function "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __cdecl std::basic_strin
g<char,struct std::char_traits<char>,class std::allocator<char> >::assign(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned int,unsigned int)" (?assign@?$basic_string@DU?$char_traits@D@std@@V?$a
llocator@D@2@@std@@QAAAAV12@ABV12@II@Z)

im.obj : error LNK2019: unresolved external symbol "void __cdecl std::_Xlen(void)" (?_Xlen@std@@YAXXZ) referenced in function "private: bool __cdecl std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::_Grow(unsigned in
t,bool)" (?_Grow@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAA_NI_N@Z)

im.obj : error LNK2001: unresolved external symbol __CxxFrameHandler
ARMV4IRel/MRSPhonim.dll : fatal error LNK1120: 8 unresolved externals

Error executing link.exe.
...全文
182 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
wildmen 2006-02-04
  • 打赏
  • 举报
回复
加个缺省构造函数 Buttons() {}
Squall_163 2006-02-03
  • 打赏
  • 举报
回复
看的好晕
cxf1976 2006-02-03
  • 打赏
  • 举报
回复
是指类里面定义的函数。
cxf1976 2006-02-03
  • 打赏
  • 举报
回复
c++宝典上好像有,你要放到容器里去,你的类的定义必须满足一定规范,具体是怎样,我忘记了,你去查一下。
021850524 2006-02-03
  • 打赏
  • 举报
回复
待会看一下, 先做个标记.
newbiestar 2006-02-03
  • 打赏
  • 举报
回复
另外,我问一下,你用的是哪个STL实现?M$的还是STLPort啥的?
newbiestar 2006-02-03
  • 打赏
  • 举报
回复
首先要有缺省构造函数,然后还要operator<和operator==,没有这三个东西,一般来说vector模版你玩不转(除非你就搞了一个vector<Buttons>出来,什么功能都不用)
luolovegui 2006-02-03
  • 打赏
  • 举报
回复
mark

16,551

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Creator Browser
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

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