Search code examples
c++virtualgloox

No matching function to gloox::ChatStateFilter::ChatStateFilter()


I am receiving the error as per the heading despite using the implementation as defined in the documentation and examples. I'm not sure what is going wrong. There is also the additional error of, No matching function for call to gloox::MessageEventFilter::MessageEventFilter() for trying to use that object as well. An example of my code is below:

class TuiHangouts : public ConnectionListener, LogHandler, MessageSessionHandler, MessageHandler,
    MessageEventHandler, ChatStateHandler, RosterListener, EventHandler, ChatStateFilter,
    MessageEventFilter
{
public:
    TuiHangouts();
    virtual ~TuiHangouts();
}

And within the *.cpp file:

GekkoFyre::TuiHangouts::TuiHangouts() : m_session(0), m_messageEventFilter(0), m_chatStateFilter(0)
{}

Any help on this would be greatly appreciated, thank you. The library that I'm trying to implement into my project, as you might have guessed, is the gloox library. Just mentioning it here if it helps.

Please beware that whilst I'm an alright coder, I have no formal education and much of the nomenclature used by such programmers is beyond incomprehensible to me. Just keep that in mind :)


Solution

  • As you can see from their reference ChatStateFilter doesn't provide a default constructor but only

    ChatStateFilter (MessageSession *parent);
    

    as you are inheriting that class with yours, you need to call the constructor in your member initializer list:

    GekkoFyre::TuiHangouts::TuiHangouts() : ChatStateFilter(&m_session), // ...
    {}