I'm basically trying to pass the value of i1 to printmessage where i want to change its value and return this to main.
thread.cpp: In function 'int main()':
thread.cpp:17: error: invalid conversion from 'void* (*)(int*)' to 'void* (*)(void
*)'
thread.cpp:17: error: initializing argument 3 of 'int pthread_create(pthread_t*,
void* const*, void* (*)(void*), void*)'
Expand|Select|Wrap|Line Numbers
- #include <iostream>
- #include <pthread.h>
- using namespace std;
- void *print_message(int *i1)
- {
- cout << "Threading\n";
- }
- int main()
- {
- int i1;
- pthread_t t1;
- i1 = 10;
- pthread_create(&t1, NULL, print_message, &i1);
- return 0;
- }