关于启动类属成员函数作线程执行体的问题

dch4890164 2006-09-12 01:04:50
UINT Robot::RobotMotionOnTracj(LPVOID pParam)
{
return NULL;
}
UINT Robot::RobRandMotionThread(LPVOID pParam)
{
return NULL;
}
void Robot::RobotMotion(int mode)
{
if (mode == 1)
{
_beginthreadex(NULL,0,(unsigned int (__stdcall *)(void *))RobRandMotionThread,(void *)this,NULL,RandThreadID);
return;
}
if (mode == 2)
{
_beginthreadex(NULL,0,(unsigned int(__stdcall *)(void *))RobotMotionOnTracj,0,&TaskAim,RandThreadID);
return;
}

}
代码如上
我已经在设置里设置了使用多线程动态库
可是编译的时候提示
E:\程序project\ACS\Robot.cpp(41) : error C2440: 'type cast' : cannot convert from '' to 'unsigned int (__stdcall *)(void *)'
None of the functions with this name in scope match the target type
E:\程序project\ACS\Robot.cpp(46) : error C2440: 'type cast' : cannot convert from '' to 'unsigned int (__stdcall *)(void *)'
None of the functions with this name in scope match the target type
-----------------------------------------------------------
为什么??
...全文
657 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
dch4890164 2006-09-12
  • 打赏
  • 举报
回复
你是对的,我明白了你的意思!
问题已经搞定
谢谢
dch4890164 2006-09-12
  • 打赏
  • 举报
回复
我不想那样,那样我就可以不用成员函数了,全局函数就可以达到目的了!
yjgx007 2006-09-12
  • 打赏
  • 举报
回复
They also should be as static function of the class.
dch4890164 2006-09-12
  • 打赏
  • 举报
回复
还是不行,同样的错误
yjgx007 2006-09-12
  • 打赏
  • 举报
回复
The both RobRandMotionThread and RobotMotionOnTracj functions should return 'void' type

15,471

社区成员

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

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