vanderlin / ofxBox2d

Openframework wrapper for box2d

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not compiling on Raspberry Pi OS (Buster)

becausetimes5 opened this issue · comments

I’m running into this error when I try to compile any program using ofxBox2d on my Raspberry Pi 4 (openFrameworks 0.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());

The addon works well under OSX and the compiles and works fine on my Raspberry Pi’s running OF 0.10.x on the Stretch version of Raspberry Pi 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& 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());
}`

Any idea how to get this working for the newer OS and OF?
Thank you!

Turns out I was using the older version of ofxBox2d (suitable for OF 0.9.x) with OF0.11.x. I replaced it with the newer version and all is working.