有一个这样的类
class CCSocketDlg : public CDialog
{
...........
};
UINT thread(LPVOID);//定义线程操作启动线程:AfxBeginThread(&thread,0);
如果我把UINT thread(LPVOID);放在CCSocketDlg里面定义就出现这样的错误:
error C2276: '&' : illegal operation on bound member function expression 没太搞明白为什么会这样
class CCSocketDlg : public CDialog
{
...........
};
UINT thread(LPVOID);//定义线程操作启动线程:AfxBeginThread(&thread,0);
如果我把UINT thread(LPVOID);放在CCSocketDlg里面定义就出现这样的错误:
error C2276: '&' : illegal operation on bound member function expression 没太搞明白为什么会这样
error C2665: 'AfxBeginThread' : none of the 2 overloads can convert parameter 1 from type 'unsigned int (void *)'看来还是放在外面比较简单方便
看来是在程序中调用时出错的,你的参数传递的有问题。
你在调用时需要加上强制转换thread为(AFX_THREADPROC)thread