- edited description
Error while building: ambiguous overload for 'operator*'
I'd been trying to build GTSAM on the Jetson TX1, when I came across the following error:
/home/nvidia/gtsam/gtsam/geometry/tests/testPoint2.cpp:107:46: error: ambiguous overload for ‘operator*’ (operand types are ‘int’ and ‘gtsam::Point2’) EXPECT(assert_equal<Point2>( Point2(4,6), 2*Point2(2,3)));
Edit: Fixed it by changing line 107 to:
EXPECT(assert_equal<Point2>( Point2(4,6), Point2(2,3)*2 ));
Comments (10)
-
reporter -
reporter - edited description
-
Hi, thanks for reporting. The point of the test is exactly to test left-multiplication with a scalar, so the above fix won't do :-) I'm actually puzzled about the error: the test failure might highlight a real problem of either TX1 compiler, Eigen, or our code (probably the latter?).
-
Weird. For what it's worth, I don't see this issue while compiling for the TX2. Are you compiling with gcc or clang? I'm using gcc.
Looking at the definition of
operator *
/// multiply with scalar inline Point2 operator*(double s, const Point2& p) { return p * s; }
it seems like type coercion from
int
todouble
is not working correctly. Just to make sure that that definition ofoperator *
is available, could you change2*Point2(2,3)))
to2.0*Point2(2,3)))
and see if there is still an issue? -
The bug is due to a new version of Eigen; they changed how they implemented
operator*
for matrices somehow -- I encountered it with gcc when building with my system Eigen, but not otherwise. I toyed around with fixes for a while but couldn't come up one other than allowing implicit conversion toPoint2
fromEigen::Vector2d
(and that conversion constructor is markedexplicit
so it seemed like a design decision that I didn't want to make a pull request to change...) -
Good to know. I'm not using system Eigen, so that must be why I didn't see it.
-
I'm using newest system Eigen in the BitBucket pipelines, and I got an ambiguous overload. When I changed it to 2.0 it worked, however.
-
-
assigned issue to
-
assigned issue to
-
@sbowman is this issue fixed for you with latest develop? Works with Eigen 3.3.4 on Ubuntu 18...
-
- changed status to resolved
Will assume fixed with latest Eigen pulled in PR #351, please re-open or create a new issue if not.
- Log in to comment