Trying to run ofxClipper on 0.9.8

Hey y’all,

I’m trying to run Baker’s ofxClipper example on version 0.9.8
( ) and I’m getting two errors:

"No matching member function for call to ‘push_back’ " which occurs when the following are called:

  1. clipMasks.getOutline().push_back( p )
  2. clipSubjects.getOutline().push_back( r )

Binding value of type ‘const vector<…>’ to reference to type ‘vector<…>’ drops ‘const’ qualifier” which occurs when the following are called:

  1. clips.getOutline()
  2. simplifiedPath.getOutline()

Any idea on how to fix this?

I’m writting without seeing code but seems like getOutlime() function returns “const vector” type which is read-only. So you can not push_back().
You could copy returning vector into your local vector variable. This copy operation could cost expensive but depends on your logic.

Qucik dirty hack is removing “const” from addon.
Or use “const_cast” on your app side.

Also if those methods return are marked as const it’s usually because the original author doesn’t want you to modify them. If you modify them by removing const from the addon it’ll probably break down cause the internal logic relies upon those vectors not being modified externally

1 Like

Could you give a bit more context for your code? As @arturo notes, if it’s const then I intended it not to be modified for some reason, but I’m unsure what you are trying to do.

Hey y’all, thanks for your responses!

@bakercp , I’m trying to run . In the actual ofxClipper.cpp I’m getting

“Binding value of type ‘const vector<…>’ to reference to type ‘vector<…>’ drops ‘const’ qualifier” error for this code:

void ofxClipper::ofPath_to_Polygons(ofPath&amp; path,ClipperLib::Paths&amp; polygons) {
    return ofxPolylines_to_Polygons(path.getOutline(),polygons);


“No matching member function for call to ‘push_back’” for this code:

void ofxClipper::polygons_to_ofPath(ClipperLib::Paths& polygons,ofPath& path) {
    vector<ClipperLib::Path>::iterator iter;
    for(iter = polygons.begin(); iter != polygons.end(); iter++) {

I’m also getting several errors in the example code, where it’s trying to push back a polyline onto an ofPath


I tried adding the points manually to the ofPath in cases such as this^ and I eventually got rid of some of the errors but it didn’t fully work.

I think this is because ofPath changed in 0.10 . See this old issue in the forum Add ofPolyline to ofPath

I just pushed updates of ofxClipper including an updated API. Please check it out if you’re still having issues.

1 Like

sick! I’ll check it out