正在链接...
IOCP.obj : error LNK2001: 无法解析的外部符号 "public: static class std::list<char,class std::allocator<char> > CIOCP::L_MSG" (?L_MSG@CIOCP@@2V?$list@DV?$allocator@D@std@@@std@@A)
Debug/ser.exe : fatal error LNK1120: 1 个无法解析的外部命令
IOCP.obj : error LNK2001: 无法解析的外部符号 "public: static class std::list<char,class std::allocator<char> > CIOCP::L_MSG" (?L_MSG@CIOCP@@2V?$list@DV?$allocator@D@std@@@std@@A)
Debug/ser.exe : fatal error LNK1120: 1 个无法解析的外部命令
你用的是VC7,如果这个类是系统的,你打开MSDN查一下这个类需要添什么LIB文件。
问题好像出在STL方面的问题,只要用了容器就会出这个错误
我唯一用过容器的函数是这样写的:
void CIOCP::readbuf(char* ch)
{
char chr;
while(ch)
{
chr=*ch;
L_MSG.push_back(chr);
}
}
类的申明如下:
class CIOCP
{
public:
int startup();
CIOCP(void);
~CIOCP(void);
void readbuf(char* ch);
static std::list<char> L_MSG;
protected:
char* buf;
HANDLE CompletionPort;
WSADATA wsd;
SYSTEM_INFO SystemInfo;
SOCKADDR_IN InternetAddr;
SOCKET Listen;
};
#include <list>
using namespace std;.....另外你的static std::list<char> L_MSG;
static估计不行
std::list<char> CIOCP::L_MSG in your cpp file