@hamoid wrote:
Hi hi
I need your expertise again. This code:
listeners.push(ofEvents().update.newListener(this, [&]() { std::cout << ofGetFrameNum() << std::endl; }));
produces this error:
In file included from /x/src/openFrameworks/libs/openFrameworks/events/ofEventUtils.h:4, from /x/src/openFrameworks/libs/openFrameworks/events/ofEvents.h:4, from /x/src/openFrameworks/libs/openFrameworks/types/ofParameter.h:3, from /x/src/openFrameworks/addons/ofxGui/src/ofxToggle.h:3, from /x/src/openFrameworks/addons/ofxGui/src/ofxGui.h:3, from /x/Desktop/edu/src/openframeworks/cerealInotify/src/config.h:6, from /x/Desktop/edu/src/openframeworks/cerealInotify/src/config.cpp:1: /x/src/openFrameworks/libs/openFrameworks/events/ofEvent.h: In instantiation of ‘std::unique_ptr<of::priv::AbstractEventToken> ofEvent<T, Mutex>::newListener(TObj*, TMethod, int) [with TObj = Config; TMethod = Config::Config(std::string)::<lambda()>; T = ofEventArgs; Mutex = std::recursive_mutex]’: /x/Desktop/edu/src/openframeworks/cerealInotify/src/config.cpp:18:6: required from here /x/src/openFrameworks/libs/openFrameworks/events/ofEvent.h:534:21: error: no matching function for call to ‘ofEvent<ofEventArgs>::make_function(Config*&, Config::Config(std::string)::<lambda()>&, int&)’ 534 | return addFunction(make_function(listener,method,priority)); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /x/src/openFrameworks/libs/openFrameworks/events/ofEvent.h:476:14: note: candidate: ‘template<class TObj> ofEvent<T, Mutex>::FunctionPtr ofEvent<T, Mutex>::make_function(TObj*, bool (TObj::*)(T&), int) [with TObj = TObj; T = ofEventArgs; Mutex = std::recursive_mutex]’ 476 | FunctionPtr make_function(TObj * listener, bool (TObj::*method)(T&), int priority){ | ^~~~~~~~~~~~~ /x/src/openFrameworks/libs/openFrameworks/events/ofEvent.h:476:14: note: template argument deduction/substitution failed: /x/src/openFrameworks/libs/openFrameworks/events/ofEvent.h:534:21: note: mismatched types ‘bool (TObj::*)(ofEventArgs&)’ and ‘Config::Config(std::string)::<lambda()>’ 534 | return addFunction(make_function(listener,method,priority)); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /x/src/openFrameworks/libs/openFrameworks/events/ofEvent.h:481:14: note: candidate: ‘template<class TObj> ofEvent<T, Mutex>::FunctionPtr ofEvent<T, Mutex>::make_function(TObj*, void (TObj::*)(T&), int) [with TObj = TObj; T = ofEventArgs; Mutex = std::recursive_mutex]’ 481 | FunctionPtr make_function(TObj * listener, void (TObj::*method)(T&), int priority){ | ^~~~~~~~~~~~~ /x/src/openFrameworks/libs/openFrameworks/events/ofEvent.h:481:14: note: template argument deduction/substitution failed: /x/src/openFrameworks/libs/openFrameworks/events/ofEvent.h:534:21: note: mismatched types ‘void (TObj::*)(ofEventArgs&)’ and ‘Config::Config(std::string)::<lambda()>’ 534 | return addFunction(make_function(listener,method,priority)); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /x/src/openFrameworks/libs/openFrameworks/events/ofEvent.h:489:14: note: candidate: ‘template<class TObj> ofEvent<T, Mutex>::FunctionPtr ofEvent<T, Mutex>::make_function(TObj*, bool (TObj::*)(const void*, T&), int) [with TObj = TObj; T = ofEventArgs; Mutex = std::recursive_mutex]’ 489 | FunctionPtr make_function(TObj * listener, bool (TObj::*method)(const void*, T&), int priority){ | ^~~~~~~~~~~~~ /x/src/openFrameworks/libs/openFrameworks/events/ofEvent.h:489:14: note: template argument deduction/substitution failed: /x/src/openFrameworks/libs/openFrameworks/events/ofEvent.h:534:21: note: mismatched types ‘bool (TObj::*)(const void*, ofEventArgs&)’ and ‘Config::Config(std::string)::<lambda()>’ 534 | return addFunction(make_function(listener,method,priority)); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /x/src/openFrameworks/libs/openFrameworks/events/ofEvent.h:494:14: note: candidate: ‘template<class TObj> ofEvent<T, Mutex>::FunctionPtr ofEvent<T, Mutex>::make_function(TObj*, void (TObj::*)(const void*, T&), int) [with TObj = TObj; T = ofEventArgs; Mutex = std::recursive_mutex]’ 494 | FunctionPtr make_function(TObj * listener, void (TObj::*method)(const void*, T&), int priority){ | ^~~~~~~~~~~~~ /x/src/openFrameworks/libs/openFrameworks/events/ofEvent.h:494:14: note: template argument deduction/substitution failed: /x/src/openFrameworks/libs/openFrameworks/events/ofEvent.h:534:21: note: mismatched types ‘void (TObj::*)(const void*, ofEventArgs&)’ and ‘Config::Config(std::string)::<lambda()>’ 534 | return addFunction(make_function(listener,method,priority)); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /x/src/openFrameworks/libs/openFrameworks/events/ofEvent.h:511:14: note: candidate: ‘ofEvent<T, Mutex>::FunctionPtr ofEvent<T, Mutex>::make_function(std::function<bool(T&)>, int) [with T = ofEventArgs; Mutex = std::recursive_mutex; ofEvent<T, Mutex>::FunctionPtr = std::shared_ptr<of::priv::Function<ofEventArgs, std::recursive_mutex> >]’ 511 | FunctionPtr make_function(std::function<bool(T&)> f, int priority) { | ^~~~~~~~~~~~~ /x/src/openFrameworks/libs/openFrameworks/events/ofEvent.h:511:14: note: candidate expects 2 arguments, 3 provided /x/src/openFrameworks/libs/openFrameworks/events/ofEvent.h:515:14: note: candidate: ‘ofEvent<T, Mutex>::FunctionPtr ofEvent<T, Mutex>::make_function(std::function<bool(const void*, T&)>, int) [with T = ofEventArgs; Mutex = std::recursive_mutex; ofEvent<T, Mutex>::FunctionPtr = std::shared_ptr<of::priv::Function<ofEventArgs, std::recursive_mutex> >]’ 515 | FunctionPtr make_function(std::function<bool(const void*, T&)> f, int priority) { | ^~~~~~~~~~~~~ /x/src/openFrameworks/libs/openFrameworks/events/ofEvent.h:515:14: note: candidate expects 2 arguments, 3 provided /x/src/openFrameworks/libs/openFrameworks/events/ofEvent.h:519:14: note: candidate: ‘ofEvent<T, Mutex>::FunctionPtr ofEvent<T, Mutex>::make_function(std::function<void(T&)>, int) [with T = ofEventArgs; Mutex = std::recursive_mutex; ofEvent<T, Mutex>::FunctionPtr = std::shared_ptr<of::priv::Function<ofEventArgs, std::recursive_mutex> >]’ 519 | FunctionPtr make_function(std::function<void(T&)> f, int priority) { | ^~~~~~~~~~~~~ /x/src/openFrameworks/libs/openFrameworks/events/ofEvent.h:519:14: note: candidate expects 2 arguments, 3 provided /x/src/openFrameworks/libs/openFrameworks/events/ofEvent.h:523:14: note: candidate: ‘ofEvent<T, Mutex>::FunctionPtr ofEvent<T, Mutex>::make_function(std::function<void(const void*, T&)>, int) [with T = ofEventArgs; Mutex = std::recursive_mutex; ofEvent<T, Mutex>::FunctionPtr = std::shared_ptr<of::priv::Function<ofEventArgs, std::recursive_mutex> >]’ 523 | FunctionPtr make_function(std::function<void(const void*, T&)> f, int priority) { | ^~~~~~~~~~~~~ /x/src/openFrameworks/libs/openFrameworks/events/ofEvent.h:523:14: note: candidate expects 2 arguments, 3 provided Process failed with exit code 1.
Unfortunately in QtCreator it’s all red text on black, no formatting, very hard to read.
How do you go about figuring out what it means? What is the useful part in this error message to help me fix the problem?
Posts: 6
Participants: 3