为何我的多线程不能通过编译呢

lin_zhlie 2001-04-21 03:28:00
为何我的多线程不能通过编译呢 ?

CWinThread* p=(CWinThread *)AfxBeginThread((AFX_THREADPROC)endFrame,this);


UINT CNodeThread::SendFrame(LPVOID pParam)
{

return 0;
}




F:\hcz\lin\sw\NodeThread.cpp(86) : error C2440: 'type cast' : cannot convert from '' to 'unsigned int (__cdecl *)(void *)'
...全文
65 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
lin_zhlie 2001-04-23
  • 打赏
  • 举报
回复
今天我把UINT CNodeThread::SendFrame(LPVOID pParam)这个函数从CNoteThread
中删掉
吧UINT SendFrame(LPVOID pParam)做成一个全局函数
就可以通过编译了!!

CNoteThread是从CWinApp中派生出来的用户线程类
难道线程控制函数SendFrame()不能作为用户线程类的成员函数吗?

horris 2001-04-21
  • 打赏
  • 举报
回复
static UINT WINAPI SendFrame(LPVOID pParam)
seesi 2001-04-21
  • 打赏
  • 举报
回复
头文件的声明加上static了没有?回调函数需要加此关键字
sjy 2001-04-21
  • 打赏
  • 举报
回复

UINT CNodeThread::SendFrame(LPVOID pParam)前加STATIC试试
ggyy 2001-04-21
  • 打赏
  • 举报
回复
CWinThread* p=(CWinThread *)AfxBeginThread((AFX_THREADPROC)endFrame,this);

endFrame高错了!!!!!是SendFrame
UINT CNodeThread::SendFrame(LPVOID pParam)
{

return 0;
}





lin_zhlie 2001-04-21
  • 打赏
  • 举报
回复
刚才没有paste完整
出错信息如下

Compiling...
NodeThread.cpp
F:\hcz\lin\sw\NodeThread.cpp(86) : 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
Error executing cl.exe.

sw.exe - 1 error(s), 0 warning(s)

15,471

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 进程/线程/DLL
社区管理员
  • 进程/线程/DLL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧