Updating of0.84 project to of0.9: troubles with ofEvent

Hi,
I’m in the process of moving a rather large Win of0.84 project to of0.9 on OSX. I removed all Windows specific code, but now I ran into another problem during compilation:

ofBaseEvent<of::priv::Function<T,Mutex>,Mutex>::remove(make_function(listener,method,priority));
ofEvent.h:284:58: No matching member function for call to ‘make_function’

ofBaseEvent<of::priv::Function<T,Mutex>,Mutex>::add(make_function(listener,method,priority));
ofEvent.h:279:55: No matching member function for call to ‘make_function’

Any hints?
OSX 10.10, XCode 7 with OSX 10.10 SDK (copied over from XCode6)

I’m having the exact same issue, same OS version and SDK. Still trying to figure it out as well.

can you post the code that is failing? or a small example that fails to compile?

The error happens in ofEvent.h (line 277 - 285):

	template<class TObj, typename TMethod>
void add(TObj * listener, TMethod method, int priority){
	ofBaseEvent<of::priv::Function<T,Mutex>,Mutex>::add(make_function(listener,method,priority));
}

template<class TObj, typename TMethod>
void remove(TObj * listener, TMethod method, int priority){
	ofBaseEvent<of::priv::Function<T,Mutex>,Mutex>::remove(make_function(listener,method,priority));
}

ofEvent.h:279:55: No matching member function for call to ‘make_function’
ofEvent.h:284:58: No matching member function for call to ‘make_function’

Clicking on the lines in question in xCode shows me a lot of

Candidate function not viable: requires 2 arguments, but three were provided (line 255, 259, 267, 270)
Candidate template ignored: failed template argument deduction (248)
Candidate template ignored: could not match bool against void (230, 243)
Candidate template ignored: could not match 'ofTouchEventArgs &' against 'ofMouseEventArgs &' (235)

This just started happening to me, if I don’t use ‘ofAddListener’ the app builds, but once I try to use an event the same it fails at the same spot as above.

Any ideas?

*** SOLVED: TRIPLE/QUADRUPLE check your ofEvent types! ***

1 Like

I’m getting this to, I’ve removed all calls to ofAddListener as well but still get it. this may be due to using multi windows?

@nickhubben Could you please describe exactly how your event types were corrupted and how you had to update the 0.8 events to work with 0.9

My problem was less about migrating to 0.9, but more about stupidly listening for an event with argument type A, but then dispatching an event with argument type B.

Are you using custom/complex events? I haven’t done any cross-window event dispatching, but I’m sure the brains on here would have some suggestions.

-N