本文介绍了关于void *参数的错误c3867的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在vs2005有一个线程类
I have a thread class at vs2005
m_hThread = (HANDLE)_beginthreadex(NULL,0, CThreadClass::start_address, this, 0, &m_Thraddr)
有一个错误C3867:
There is a error C3867:
"CThreadClass::start_address": function lost function list.
Unsigned CThreadClass::start_address(void* obj)
{
return FALSE;
}
你能告诉我如何解决这个错误吗?
我来自博客 []
但我不想要一个静态类函数。
Could you tell me how can I cover this error?
I referee from the blog http://www.cppblog.com/API/archive/2011/03/11/141563.html[^]
But I don't want a static class function.
推荐答案
CThreadClass
{
// ...
void start_thread();
private::
// Static thread function
unsigned __stdcall start_address(void* obj);
// Non-static function called from static version
unsigned thread_func();
};
void CThreadClass::start_thread()
{
m_hThread = (HANDLE)_beginthreadex(NULL,0, &CThreadClass::start_address, this, 0, &m_Thraddr);
}
// Static thread function
unsigned CThreadClass::start_address(void* obj)
{
CThreadClass *p = (CThreadClass *)obj;
return p->thread_func();
}
// Non-static function called from static thread function
unsigned CThreadClass::thread_func()
{
// Do your work here using the class's member variables and functions
return FALSE;
}
这篇关于关于void *参数的错误c3867的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!