简体   繁体   English

返回值与函数返回类型不匹配

[英]return value does not match function return type

I'm getting errors in vs2013 with the dot_product functions. 我在使用dot_product函数的vs2013中遇到错误。

Here is my usage for dot_product 这是我对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. 使用const参数的其他函数也遇到相同的错误。 Anyone know what could cause this problem? 有人知道什么可能导致此问题吗?

Edit:: I took a screenshot of the errors, [link] http://puu.sh/kaoiy/3baebde6af.png 编辑::我拍摄了错误的屏幕截图,[链接] http://puu.sh/kaoiy/3baebde6af.png

dot_product(&distance, &distance) <= radiusSum * radiusSum; will result in a c++ bool type. 将导致c ++ bool类型。

Bool circles_collide(const Circle* a, const Circle* b) expects to return Bool . Bool circles_collide(const Circle* a, const Circle* b)期望返回Bool

I don't know what Bool is, but looks like the compiler can't make implicitly make one from bool . 我不知道Bool是什么,但是看起来编译器无法从bool隐式地制造一个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 返回值类型与函数类型CONST不匹配 - Return value type does not match the function type CONST C++ 返回值类型(整数)与 function 类型不匹配 - C++ return value type (integer) does not match the function type C ++返回值类型与函数类型不匹配 - C++ Return value type does not match the function type 类型为nullptr的宏返回值与函数类型不匹配 - Macro return value of type nullptr does not match function type 返回值类型与 function 类型不匹配(返回类型为嵌套类) - return value type does not match the function type (return type is a nested class) “返回值类型与函数类型不匹配”等VS编译错误 - “return value type does not match the function type” and other VS compile errors 返回值类型与 function 类型不匹配,尽管它在 header 的许多其他点上工作 - Return value type does not match the function type despite it working in many other points in the header 返回指向常量getter的指针时,返回值类型与函数类型不匹配 - Return value type does not match function type when returning pointer to constant getter ASSERT_TRUE()返回类型与gtest中的函数类型不匹配 - ASSERT_TRUE() return type does not match function type in gtest C ++返回类型与函数类型不匹配 - C++ return type does not match function type
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM