0
votes

I am trying to use a pthread library.

What is the cause of this error?

error C2664: 'pthread_create' : cannot convert parameter 3 from 'void *(__clrcall *)(void *)' to 'void *(__cdecl *)(void *)

Here's my code:

pthread_create(&thread1,NULL,sub_m,(void *)data);

void *sub_m(void* data)
1
Are you, by any chance, compiling your code as Managed C++? - Paul
I am using the visual studio 2010 - stellar
__clrcall in your error message makes me think the type of C++ project is Managed C++, not Native C++. Are you planning to use .NET Framework in your project? Actually, the solution provided by @toast should work, but disabling C++/CLI support (provided you don't need it) will not require to specify call convention explicitly. - Paul

1 Answers

0
votes

make it void __cdecl sub_m(void *data). You are in managed code, so you need to get back into the proper calling convention.