AfxBeginThread((AFX_THREADPROC)listenThread,NULL); AfxBeginThread(listenThread,NULL); 用了,不行 rror C2665: 'AfxBeginThread' : none of the 2 overloads can convert parameter 1 from type 'void (void *)' Error executing cl.exe.
error C2440: 'type cast' : cannot convert from '' to 'unsigned int (__cdecl *)(void *)' None of the functions with this name in scope match the target type不行,是我那个函数的参数问题吗? 郁闷,我太菜了~~。
我先在 Dlg.h 中 private: UINT listenThread(LPVOID params); Dlg.cpp中写了 UINT CPoiDlg::listenThread(LPVOID params) { ...... } 然后在启动的地方写了(都注了,都跑过了) //AfxBeginThread((AFX_THREADPROC)listeninThread,NULL); //AfxBeginThread(listenThread, NULL,NULL,NULL,NULL,NULL); //AfxBeginThread(listeninThread,NULL); 各位的方法,我都试了下,还是有这个错 error C2440: 'type cast' : cannot convert from '' to 'unsigned int (__cdecl *)(void *)' None of the functions with this name in scope match the target type就是跑不过,真的很郁闷,到底是什么问题
我先在 Dlg.h 中 private: UINT listenThread(LPVOID params); Dlg.cpp中写了 UINT CPoiDlg::listenThread(LPVOID params) { ...... } 然后在启动的地方写了(都注了,都跑过了) //AfxBeginThread((AFX_THREADPROC)listeninThread,NULL); //AfxBeginThread(listenThread, NULL,NULL,NULL,NULL,NULL); //AfxBeginThread(listeninThread,NULL); 各位的方法,我都试了下,还是有这个错 error C2440: 'type cast' : cannot convert from '' to 'unsigned int (__cdecl *)(void *)' None of the functions with this name in scope match the target type就是跑不过,真的很郁闷,到底是什么问题
或者贴段代码
因为我要用的是Dig一起来,就一直在监听(就是用listenThread)这个函数
AfxBeginThread(listenThread,NULL);
用了,不行
rror C2665: 'AfxBeginThread' : none of the 2 overloads can convert parameter 1 from type 'void (void *)'
Error executing cl.exe.
AfxBeginThread(listenThread, this,NULL,NULL,NULL,NULL);然后线程里
cDlg *m_dlg=(cDlg *)params;
m_dlg->listenThread();
AfxBeginThread(listenThread,(void*)NULL);还是不行
None of the functions with this name in scope match the target type不行,是我那个函数的参数问题吗?
郁闷,我太菜了~~。
这样去定义你的函数
AfxBeginThread(cDlg::listenThread, NULL);
如果在cDlg类里面用
AfxBeginThread(listenThread, NULL);
Dlg.h 中
private:
UINT listenThread(LPVOID params);
Dlg.cpp中写了
UINT CPoiDlg::listenThread(LPVOID params)
{
......
}
然后在启动的地方写了(都注了,都跑过了)
//AfxBeginThread((AFX_THREADPROC)listeninThread,NULL);
//AfxBeginThread(listenThread, NULL,NULL,NULL,NULL,NULL);
//AfxBeginThread(listeninThread,NULL);
各位的方法,我都试了下,还是有这个错
error C2440: 'type cast' : cannot convert from '' to 'unsigned int (__cdecl *)(void *)'
None of the functions with this name in scope match the target type就是跑不过,真的很郁闷,到底是什么问题
Dlg.h 中
private:
UINT listenThread(LPVOID params);
Dlg.cpp中写了
UINT CPoiDlg::listenThread(LPVOID params)
{
......
}
然后在启动的地方写了(都注了,都跑过了)
//AfxBeginThread((AFX_THREADPROC)listeninThread,NULL);
//AfxBeginThread(listenThread, NULL,NULL,NULL,NULL,NULL);
//AfxBeginThread(listeninThread,NULL);
各位的方法,我都试了下,还是有这个错
error C2440: 'type cast' : cannot convert from '' to 'unsigned int (__cdecl *)(void *)'
None of the functions with this name in scope match the target type就是跑不过,真的很郁闷,到底是什么问题
应该是参数的问题。
UINT CPoiDlg::listenThread(LPVOID params) //改成UNIT listenThread(LPVOID params)