Reputation: 4052
So I'm a predominantly Linux programmer who's recently got a job working with Windows. I've developed some numerical code, but now need to put a simple GUI on.
At the moment I have a button with an onClick
event with calls a function called start
which kicks off the numerical stuff. But this freezes the GUI so I want to put the call to start
into a worker thread.
I've declared start
like this: void __cdecl start(void* args)
. I added the __cdec1
as I was previously getting the error: error C2664: '_beginthread' : cannot convert parameter 1 from 'void (__clrcall *)(void *)' to 'void (__cdecl *)(void *)'
.
Now when the button is clicked the following code runs:
output->Text = "Starting";
_beginthread(start, 0, NULL);
output->Text = "Done";
This gives me the confusing error cannot convert parameter 1 from 'void (__cdecl *)(void *)' to 'void (__cdecl *)(void *)'
.
If anyone can see where I'm going wrong I'd be eternally grateful.
Upvotes: 2
Views: 1999