cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
Using pthreads
Using pthreads
Feb 16, 2011 at 9:26pm UTC
TheMystro
(2)
I found an example code that utilizes pthreads to do matrix multiplication. I wanted to run it to see exactly how it works but I am getting an error that I am not sure how to fix. The code is located at:
http://macboypro.com/blog/2009/06/29/matrix-multiplication-in-c-using-pthreads-on-linux/
I get an error at the command:
struct v *data = param;
located in the runner function. Anyone know how I can get this to work properly?
Thanks.
Feb 17, 2011 at 5:03pm UTC
TheMystro
(2)
The problem that I am having is in this function:
void *multiply(void *param)
{
struct v *data = param;
int n;
int sum = 0;
for(n = 0; n < K; n++)
{
sum += A[data->i][n] * B[n][data->j];
}
C[data->i][data->j] = sum;
pthread_exit(0);
}
The error I get is:
invalid conversion from void* to v*
Thanks for any help.
Feb 17, 2011 at 7:36pm UTC
jsmith
(5804)
You have to perform an explicit cast of the pointer.
Topic archived. No new replies allowed.