#ifndef __STUCT_CPP__
#define __STUCT_CPP__
struct ShareInfo : public TListObj
{
int packetNo;
int hostCnt;
int fileCnt;
public:
ShareInfo(int packetNo = 0);
void LinkList(ShareInfo *top);
};
ShareInfo::ShareInfo(int _packetNo)
{
}
void ShareInfo::LinkList(ShareInfo *top)
{
}
#endif
由于STDAFX.H被多次引用所以会出现error LNK2005的重定义错误。但是为什么如果将方法定义成inline的就不会出现错误呢?
struct ShareInfo : public TListObj
{
int packetNo;
int hostCnt;
int fileCnt;
public:
inline ShareInfo(int packetNo = 0);
inline void LinkList(ShareInfo *top);
};