I’m running into this error when I try to compile any program using ofxBox2d on my Raspberry Pi 4 (openFrameworks 11):
/home/pi/openFrameworks/addons/ofxBox2d/src/ofxBox2dPolygonUtils.h:544:42: error: cannot bind non-const lvalue reference of type ‘ofPolyline&’ {aka ‘ofPolyline_<glm::vec<3, float, (glm::qualifier)0> >&’} to an rvalue of type ‘ofPolyline’ {aka ‘ofPolyline_<glm::vec<3, float, (glm::qualifier)0> >’}
return getConvexHull(line.getVertices());
It works under OSX and the ofxBox2d addon compiles and works fine on my Raspberry Pi’s running OF 0.10.x on the Stretch version of the OS. Here is the code that the error message points to (as well as a function of the same name that the original function calls). The second function is on line 544, the line the error message references.
static ofPolyline getConvexHull(vector<ofDefaultVertexType>& linePts){
vector < hPoint > ptsIn;
for (size_t i = 0; i < linePts.size(); i++){
hPoint pt;
pt.x = linePts[i].x;
pt.y = linePts[i].y;
ptsIn.push_back(pt);
}
vector < hPoint > ptsOut;
ptsOut = calcConvexHull(ptsIn);
ofPolyline outLine;
for (size_t i = 0; i < ptsOut.size(); i++){
outLine.addVertex(ofPoint(ptsOut[i].x, ptsOut[i].y));
}
return outLine;
}
static ofPolyline getConvexHull(ofPolyline &line){
return getConvexHull(line.getVertices());
}
Can anyone point me in the right direction here, please? Am I missing something really obvious?
Thank you!