需要有关编译链接错误LNK2001的帮助 [英] need help on compilation link error LNK2001
本文介绍了需要有关编译链接错误LNK2001的帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
任何人都可以帮助我解决此链接错误.不知道为什么会这样:
Could anyone help me out to solve this linking error. Not sure why this happens:
Error 1 error LNK2001: unresolved external symbol "protected: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall cPlainKey::Print(void)" (?Print@cPlainKey@@MAE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) data.obj
涉及的代码:
the code which is involved in this:
#define cString std::string
class cPlainKeyDummy : public cPlainKey {
private:
char *str;
protected:
virtual cString Print(void);
}
cString cPlainKey::ToString(bool hide)
{
char *tmp;
sprintf(tmp, (hide ? "%c %.*X %s %.4s..." : "%c %.*X %s %s"),type,IdSize(),id,&PrintKeyNr(),&Print());
return tmp;
}
cString cPlainKeyDummy::Print(void)
{
return string(str);
}
添加错误数据:
Adding mising data:
class cPlainKey : public cSimpleItem {
friend class cPlainKeys;
friend class cMutableKey;
private:
bool au, del, super;
protected:
virtual cString Print(void);//=0;
public:
int type, id, keynr;
};
class cMutableKey : public cPlainKey {
private:
cPlainKey *real;
protected:
virtual cString Print(void);
virtual cPlainKey *Alloc(void) const=0;
public:
};
class cSimpleListBase;
class cSimpleItem {
friend class cSimpleListBase;
private:
cSimpleItem *next;
public:
virtual ~cSimpleItem() {}
cSimpleItem *Next(void) const { return next; }
};
cString cMutableKey::Print(void)
{
return real->Print();
}
cString cPlainKey::PrintKeyNr(void)
{
char ret[16];
sprintf(ret, "%02X",keynr);
return string(ret);
}
int cPlainKey::IdSize(void)
{
return id>0xFF ? (id>0xFFFF ? 6 : 4) : 2;
}
文件很大,所以我试图找到所有的print()...
File is quite big, so I am trying to find all print()...
The code compiles fine it''s just not linking.
推荐答案
basic_string @ DU?
basic_string@DU?
char_traits @ D @ std @ @V?
char_traits@D@std@@V?
allocator @ D @ 2 @@ std @@ XZ)data.obj
allocator@D@2@@std@@XZ) data.obj
涉及的代码:
the code which is involved in this:
#define cString std::string
class cPlainKeyDummy : public cPlainKey {
private:
char *str;
protected:
virtual cString Print(void);
}
cString cPlainKey::ToString(bool hide)
{
char *tmp;
sprintf(tmp, (hide ? "%c %.*X %s %.4s..." : "%c %.*X %s %s"),type,IdSize(),id,&PrintKeyNr(),&Print());
return tmp;
}
cString cPlainKeyDummy::Print(void)
{
return string(str);
}
添加错误数据:
Adding mising data:
class cPlainKey : public cSimpleItem {
friend class cPlainKeys;
friend class cMutableKey;
private:
bool au, del, super;
protected:
virtual cString Print(void);//=0;
public:
int type, id, keynr;
};
class cMutableKey : public cPlainKey {
private:
cPlainKey *real;
protected:
virtual cString Print(void);
virtual cPlainKey *Alloc(void) const=0;
public:
};
class cSimpleListBase;
class cSimpleItem {
friend class cSimpleListBase;
private:
cSimpleItem *next;
public:
virtual ~cSimpleItem() {}
cSimpleItem *Next(void) const { return next; }
};
cString cMutableKey::Print(void)
{
return real->Print();
}
cString cPlainKey::PrintKeyNr(void)
{
char ret[16];
sprintf(ret, "%02X",keynr);
return string(ret);
}
int cPlainKey::IdSize(void)
{
return id>0xFF ? (id>0xFFFF ? 6 : 4) : 2;
}
文件很大,所以我试图找到所有的print()...
代码可以很好地编译,只是不链接.
File is quite big, so I am trying to find all print()...
The code compiles fine it''s just not linking.
这篇关于需要有关编译链接错误LNK2001的帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文