Re: Failed compile when adding AfxBeginThread
- From: David Wilkinson <no-reply@xxxxxxxxxxxx>
- Date: Wed, 07 Sep 2005 15:56:55 -0400
Lilith wrote:
I may have brought this up a while back but haven't met with any success regarding the suggestions I received. This is frustrating to the point of needing to post again.
Essentially I'm attempting my first shot at a worker thread. When the "go" button is clicked it invokes...
void CUNCTestView::OnUncButton() {
CWinThread *eSafeThread = AfxBeginThread (CUNCTestView::ProcesseSafe, NULL);
}
The header for the thread function is...
UINT CUNCTestView::ProcesseSafe(LPVOID pParam)
The error I get is...
'AfxBeginThread' : none of the 2 overloads can convert parameter 1 from type 'unsigned int (void *)'
I thought that perhaps the problem was the this pointer being passed
to AfxBeginThread so I tried making the function static. That brought
a different complaint from the compiler.
Is it possible that functions passed to AfxBeginThread need to be non-members of a class? Should I break off this function from the class and make it stand alone?
TIA,
Lilith:
The thread function must be a non-class function, or a static member of a class. Show us the error you get when you make the thread function a static member.
David Wilkinson .
- Follow-Ups:
- Re: Failed compile when adding AfxBeginThread
- From: Lilith
- Re: Failed compile when adding AfxBeginThread
- References:
- Failed compile when adding AfxBeginThread
- From: Lilith
- Failed compile when adding AfxBeginThread
- Prev by Date: Failed compile when adding AfxBeginThread
- Next by Date: Weird error! Please help!
- Previous by thread: Failed compile when adding AfxBeginThread
- Next by thread: Re: Failed compile when adding AfxBeginThread
- Index(es):
Loading