One error, one question
Help !
I''ve got this one error in my program that I just cant seem to understand, here''s the error:
ANSI C++ forbids implicit conversion from ''void *'' in assignment
And here''s the line that creates the error:
p->verts = malloc (sizeof (vec3_t) * p->numvertex);
It must be the way I''m trying to call malloc, but I''ve no idea what to do about it. If it helps I''m using dev-c (mingw)
Thanks.
quote:Original post by pauljg
And here''s the line that creates the error:
p->verts = malloc (sizeof (vec3_t) * p->numvertex);
seems ok to me, just one little nuance:
p->verts = (vec3_t *)malloc (sizeof (vec3_t) * p->numvertex);
this ought to fix the problem
C++ tightens the type-checking required over and above that of C. malloc returns a void*. In C, you can implicitly cast void* to any other type. In C++ you must make the cast explicit.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement