librelist archives

« back to archive

Error while compiling "class_name method malformed"

Error while compiling "class_name method malformed"

From:
Ashitha Velayudhan
Date:
2014-11-18 @ 00:34
Hi ,
I keep getting this error "class_name method malformed" when I try to
compile a new element AQM.  I tried changing the space before and after
return statement in class_name.

AQM.hh
=======

#ifndef CLICK_AQM_HH
#define CLICK_AQM_HH
#include <click/element.hh>
#include <click/ewma.hh>
CLICK_DECLS

class AQM : public Element {
  public:
    AQM() CLICK_COLD;
    ~AQM() CLICK_COLD;

    const char *class_name() const { return "AQM";}
    void push(int, Packet *);


};

CLICK_ENDDECLS
#endif

AQM.cc
=========
#include <click/config.h>
#include "AQM.hh"
#include <click/error.hh>
#include <click/args.hh>
#include <click/straccum.hh>
CLICK_DECLS

AQM::AQM()
{
}

AQM::~AQM()
{
}

void
AQM::push(int, Packet* p)
{
        output[0].push(p);
}

EXPORT_ELEMENT(AQM);
ELEMENT_REQUIRES(linuxmodule);

CLICK_ENDDECLS

Thanks
Ashitha

Re: [click] Error while compiling "class_name method malformed"

From:
Tom Barbette
Date:
2014-11-19 @ 13:50
Hi,

Are you sure it's the error?
Trying to compile your element, I had to change "output[0].push(p);"
by "output(0).push(p);"
and it worked. Another thought is that all click elements files are lower
case I think. Maybe it would explain a classname error as click does some
statical checking...

Good luck,


*Tom Barbette*