简体   繁体   中英

return value does not match function return type

I'm getting errors in vs2013 with the dot_product functions.

Here is my usage for dot_product

// This is in a header file.
Bool circles_collide(const Circle* a, const Circle* b)
{
   const float radiusSum = a->radius + b->radius;
   const Vector2D distance = subtract_vector(&(a->center), &(b->center));
   return dot_product(&distance, &distance) <= radiusSum * radiusSum;
}


 //This is the the implementation of dot_product in another header file.
float dot_product(const Vector2D* a, const Vector2D* b) 
{
    return a->x * b->x + a->y * b->y;
}

I'm also getting same errors with other functions that use const parameters. Anyone know what could cause this problem?

Edit:: I took a screenshot of the errors, [link] http://puu.sh/kaoiy/3baebde6af.png

dot_product(&distance, &distance) <= radiusSum * radiusSum; will result in a c++ bool type.

Bool circles_collide(const Circle* a, const Circle* b) expects to return Bool .

I don't know what Bool is, but looks like the compiler can't make implicitly make one from bool .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM