解决给分
报错为:error LNK2001: unresolvedexternalsymbol"public:staticclassCList<structSB_InterphoneManger::_tagDEVICE_ID *,struct SB_InterphoneManger::_tagDEVICE_ID *> SB_InterphoneManger::lstDevice" (?lstDevice@SB_InterphoneManger@
@2V?$CList@PAU_tagDEVICE_ID@SB_InterphoneManger@@PAU12@@@A)
error LNK2001: unresolved external symbol "public: static struct SB_InterphoneManger::_tagDEVICE_ID * __cdecl SB_InterphoneManger::ListFind(struct sockaddr_in,unsigned long)" (?ListFind@SB_InterphoneManger@@SAPAU_tagDEVICE_
ID@1@Usockaddr_in@@K@Z)
基本都是这类错误 这事什么错误 应该怎么解决
[解决办法]
模板类CList的static的成员变量有没有在类外部进行定义???
[解决办法]
要在外部定义么?
static CRITICAL_SECTION csListProtect;直接在类里面定义不对么?
答:
要的。
类的静态成员只属于类,不属于类的对象。
在类中声明,然后要在外部定义。