Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

pauljg

One error, one question

This topic is 6024 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
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


Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!