[Click] click Digest, Vol 94, Issue 3

Eddie Kohler kohler at cs.ucla.edu
Tue May 17 11:01:26 EDT 2011


It probably isn't the "const".  It could be your compiler version.  But I'm
glad you've got it working for now.

Eddie


On 5/17/11 5:51 AM, Dongyu Yang wrote:
> Thank you for Eddie!
> 
> The problem is this, when i define new elements as bellow:
> 
> 
> class GenericAlgorithm : public Element{
> public:
> GenericAlgorithm() {}
> virtual ~GenericAlgorithm() {}
> 
> virtual int algorithm(Vector<struct path_info *> source_routes, 
> Vector<IPAddress> *ret_source_routes);
> }
> 
> 
> the element CAMAlgorithm define as bellow:
> 
> 
> class CAMAlgorithm : public GenericAlgorithm{
> public:
> CAMAlgorithm();
> ~CAMAlgorithm();
> 
> const char *class_name() const { return "CAMAlgorithm"; }
> const char *port_count() const { return PORTS_0_0; }
> const char *processing() const { return AGNOSTIC; }
> 
> int configure(Vector<String> &conf, ErrorHandler *errh);
> bool can_live_reconfigure() const { return false; }
> void *cast(const char *);
> 
> int algorithm(Vector<struct path_info *> source_routes, Vector<IPAddress> 
> *ret_source_routes);
> 
> private:
> uint8_t _parameter_b;
> uint8_t _parameter_u;
> };
> 
> 
> then the problem happened, compile OK, link error:
> 
> ..... grid/genericalgorithm.hh:14: undefined reference to `vtable for 
> GenericAlgorithm
> camalgorithm.o:(.rodata._ZTI12CAMAlgorithm[typeinfo for CAMAlgorithm]+0x8): 
> undefined reference to `typeinfo for GenericAlgorithm'
> 
> 
> 
> but when I add const, as bellow , it is OK,
> 
> 
> class GenericAlgorithm : public Element{
> public:
> GenericAlgorithm() {}
> virtual ~GenericAlgorithm() {}
> 
> virtual int algorithm(Vector<struct path_info *> source_routes, 
> Vector<IPAddress> *ret_source_routes)/const/;
> }
> 
> 
> the element CAMAlgorithm define as bellow:
> 
> 
> class CAMAlgorithm : public GenericAlgorithm{
> public:
> CAMAlgorithm();
> ~CAMAlgorithm();
> 
> const char *class_name() const { return "CAMAlgorithm"; }
> const char *port_count() const { return PORTS_0_0; }
> const char *processing() const { return AGNOSTIC; }
> 
> int configure(Vector<String> &conf, ErrorHandler *errh);
> bool can_live_reconfigure() const { return false; }
> void *cast(const char *);
> 
> int algorithm(Vector<struct path_info *> source_routes, Vector<IPAddress> 
> *ret_source_routes)/const/;
> 
> private:
> uint8_t _parameter_b;
> uint8_t _parameter_u;
> };
> 
> so maybe it's my problem!
> 
> Thanks for your help!
> 
> 
> 
> 
> 在 2011年5月12日 上午2:34,zi feng <zfeng at cs.ucr.edu 
> <mailto:zfeng at cs.ucr.edu>>写道:
> 
>     Thank you Eddie.
> 
>     I have fixed the problem :)
> 
>     Zi
> 
> 
>     2011/5/11 Eddie Kohler <kohler at cs.ucla.edu <mailto:kohler at cs.ucla.edu>>
> 
>         Zi Feng, Dongyu,
> 
>         I could not replicate this problem. Are you still having it? It might be
>         that your compiler is not emitting the vtables for these generic
>         interfaces,
>         which are defined only in header files. I added some .cc files too to
>         attempt
>         to fix the problem -- try "make elemlist; make" -- but I am not sure
>         it will work.
> 
>         Eddie
> 
> 
>         On 4/19/11 6:37 PM, Dongyu Yang wrote:
>          > Hello, zi feng!
>          >
>          > do you find what case the problem, I have the similar problem, would
>          > you tell me how to solve it?
>          >
>          > Thanks!!
>          >
>          >
>          >
>          >
>          > 2011/4/7<click-request at pdos.csail.mit.edu
>         <mailto:click-request at pdos.csail.mit.edu>>
>          >
>          >> Send click mailing list submissions to
>          >> click at amsterdam.lcs.mit.edu <mailto:click at amsterdam.lcs.mit.edu>
>          >>
>          >> To subscribe or unsubscribe via the World Wide Web, visit
>          >> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
>          >> or, via email, send a message with subject or body 'help' to
>          >> click-request at amsterdam.lcs.mit.edu
>         <mailto:click-request at amsterdam.lcs.mit.edu>
>          >>
>          >> You can reach the person managing the list at
>          >> click-owner at amsterdam.lcs.mit.edu
>         <mailto:click-owner at amsterdam.lcs.mit.edu>
>          >>
>          >> When replying, please edit your Subject line so it is more specific
>          >> than "Re: Contents of click digest..."
>          >>
>          >> Today's Topics:
>          >>
>          >> 1. compiling problem with gridgenricmetric in click (zi feng)
>          >>
>          >>
>          >> ---------- 已转发邮件 ----------
>          >> From: zi feng<zfeng at cs.ucr.edu <mailto:zfeng at cs.ucr.edu>>
>          >> To: click<click at pdos.csail.mit.edu <mailto:click at pdos.csail.mit.edu>>
>          >> Date: Wed, 6 Apr 2011 00:10:52 -0700
>          >> Subject: [Click] compiling problem with gridgenricmetric in click
>          >> Hi all,
>          >>
>          >> I am having a problem compiling click. Everything was working
>         before. I
>          >> just
>          >> did a 'make clean' then I configured it again, then 'make
>         elemlist' and
>          >> 'make'. Then I get the following errors with reference to
>          >> gridgenericmetric:
>          >> -----------------------------------------
>          >> LINK click
>          >> bottleneckmetric.o(.text+0x5b): In function
>          >> `BottleneckMetric::~BottleneckMetric()':
>          >> ../elements/grid/gridgenericmetric.hh:17: undefined reference to
>         `vtable
>          >> for
>          >> GridGenericMetric'
>          >> bottleneckmetric.o(.text+0x77): In function
>          >> `BottleneckMetric::~BottleneckMetric()':
>          >> ../elements/grid/gridgenericmetric.hh:17: undefined reference to
>         `vtable
>          >> for
>          >> GridGenericMetric'
>          >> bottleneckmetric.o(.text+0x94): In function
>          >> `BottleneckMetric::~BottleneckMetric()':
>          >> ../elements/grid/gridgenericmetric.hh:17: undefined reference to
>         `vtable
>          >> for
>          >> GridGenericMetric'
>          >> bottleneckmetric.o(.gnu.linkonce.r._ZTV16BottleneckMetric+0x80):
>         undefined
>          >> reference to `GridGenericMetric::get_link_etx(EtherAddress const&,
>         bool)'
>          >> bottleneckmetric.o(.gnu.linkonce.r._ZTI16BottleneckMetric+0x8):
>         undefined
>          >> reference to `typeinfo for GridGenericMetric'
>          >> e2elossmetric.o(.text+0x63): In function
>         `E2ELossMetric::~E2ELossMetric()':
>          >> ../elements/grid/gridgenericmetric.hh:17: undefined reference to
>         `vtable
>          >> for
>          >> GridGenericMetric'
>          >> e2elossmetric.o(.text+0x7f): In function
>         `E2ELossMetric::~E2ELossMetric()':
>          >> ../elements/grid/gridgenericmetric.hh:17: undefined reference to
>         `vtable
>          >> for
>          >> GridGenericMetric'
>          >> e2elossmetric.o(.text+0x9c): In function
>         `E2ELossMetric::~E2ELossMetric()':
>          >> ../elements/grid/gridgenericmetric.hh:17: undefined reference to
>         `vtable
>          >> for
>          >> GridGenericMetric'
>          >> e2elossmetric.o(.gnu.linkonce.r._ZTV13E2ELossMetric+0x80): undefined
>          >> reference to `GridGenericMetric::get_link_etx(EtherAddress const&,
>         bool)'
>          >> e2elossmetric.o(.gnu.linkonce.r._ZTI13E2ELossMetric+0x8): undefined
>          >> reference to `typeinfo for GridGenericMetric'
>          >> etx2metric.o(.text+0x63): In function `ETX2Metric::~ETX2Metric()':
>          >> ../elements/grid/gridgenericmetric.hh:17: undefined reference to
>         `vtable
>          >> for
>          >> GridGenericMetric'
>          >> etx2metric.o(.text+0x7f): In function `ETX2Metric::~ETX2Metric()':
>          >> ../elements/grid/gridgenericmetric.hh:17: undefined reference to
>         `vtable
>          >> for
>          >> GridGenericMetric'
>          >> etx2metric.o(.text+0x9c): In function `ETX2Metric::~ETX2Metric()':
>          >> ../elements/grid/gridgenericmetric.hh:17: undefined reference to
>         `vtable
>          >> for
>          >> GridGenericMetric'
>          >> etx2metric.o(.gnu.linkonce.r._ZTV10ETX2Metric+0x80): undefined
>         reference to
>          >> `GridGenericMetric::get_link_etx(EtherAddress const&, bool)'
>          >> etx2metric.o(.gnu.linkonce.r._ZTI10ETX2Metric+0x8): undefined
>         reference to
>          >> `typeinfo for GridGenericMetric'
>          >> etxmetric.o(.text+0x63): In function `ETXMetric::~ETXMetric()':
>          >> ../elements/grid/gridgenericmetric.hh:17: undefined reference to
>         `vtable
>          >> for
>          >> GridGenericMetric'
>          >> etxmetric.o(.text+0x7f): In function `ETXMetric::~ETXMetric()':
>          >> ../elements/grid/gridgenericmetric.hh:17: undefined reference to
>         `vtable
>          >> for
>          >> GridGenericMetric'
>          >> etxmetric.o(.text+0x9c): In function `ETXMetric::~ETXMetric()':
>          >> ../elements/grid/gridgenericmetric.hh:17: undefined reference to
>         `vtable
>          >> for
>          >> GridGenericMetric'
>          >> etxmetric.o(.gnu.linkonce.r._ZTI9ETXMetric+0x8): undefined
>         reference to
>          >> `typeinfo for GridGenericMetric'
>          >> hopcountmetric.o(.text+0x4b): In function
>          >> `HopcountMetric::~HopcountMetric()':
>          >> ../elements/grid/gridgenericmetric.hh:17: undefined reference to
>         `vtable
>          >> for
>          >> GridGenericMetric'
>          >> hopcountmetric.o(.text+0x67): In function
>          >> `HopcountMetric::~HopcountMetric()':
>          >> ../elements/grid/gridgenericmetric.hh:17: undefined reference to
>         `vtable
>          >> for
>          >> GridGenericMetric'
>          >> hopcountmetric.o(.text+0x84): In function
>          >> `HopcountMetric::~HopcountMetric()':
>          >> ../elements/grid/gridgenericmetric.hh:17: undefined reference to
>         `vtable
>          >> for
>          >> GridGenericMetric'
>          >> hopcountmetric.o(.gnu.linkonce.r._ZTV14HopcountMetric+0x80): undefined
>          >> reference to
>          >> `GridGenericMetric::get_link_etx(EtherAd
>          >> dress const&, bool)'
>          >> hopcountmetric.o(.gnu.linkonce.r._ZTI14HopcountMetric+0x8): undefined
>          >> reference to `typeinfo for GridGenericMetric'
>          >> lirmetric.o(.text+0x5b): In function `LIRMetric::~LIRMetric()':
>          >> ../elements/grid/gridgenericmetric.hh:17: undefined reference to
>         `vtable
>          >> for
>          >> GridGenericMetric'
>          >> lirmetric.o(.text+0x77): In function `LIRMetric::~LIRMetric()':
>          >> ../elements/grid/gridgenericmetric.hh:17: undefined reference to
>         `vtable
>          >> for
>          >> GridGenericMetric'
>          >> lirmetric.o(.text+0x94): In function `LIRMetric::~LIRMetric()':
>          >> ../elements/grid/gridgenericmetric.hh:17: undefined reference to
>         `vtable
>          >> for
>          >> GridGenericMetric'
>          >> lirmetric.o(.gnu.linkonce.r._ZTV9LIRMetric+0x80): undefined
>         reference to
>          >> `GridGenericMetric::get_link_etx(EtherAddress
>          >> const
>          >> &, bool)'
>          >> lirmetric.o(.gnu.linkonce.r._ZTI9LIRMetric+0x8): undefined
>         reference to
>          >> `typeinfo for GridGenericMetric'
>          >> lirmetric.o(.gnu.linkonce.r._ZTI9LIRMetric+0x8): undefined
>         reference to
>          >> `typeinfo for GridGenericMetric'
>          >> threshmetric.o(.text+0x6b): In function
>          >> `ThresholdMetric::~ThresholdMetric()':
>          >> ../elements/grid/gridgenericmetric.hh:17: undefined reference to
>         `vtable
>          >> for
>          >> GridGenericMetric'
>          >> threshmetric.o(.text+0x87): In function
>          >> `ThresholdMetric::~ThresholdMetric()':
>          >> ../elements/grid/gridgenericmetric.hh:17: undefined reference to
>         `vtable
>          >> for
>          >> GridGenericMetric'
>          >> threshmetric.o(.text+0xa4): In function
>          >> `ThresholdMetric::~ThresholdMetric()':
>          >> ../elements/grid/gridgenericmetric.hh:17: undefined reference to
>         `vtable
>          >> for
>          >> GridGenericMetric'
>          >> threshmetric.o(.gnu.linkonce.r._ZTV15ThresholdMetric+0x80): undefined
>          >> reference to
>          >> `GridGenericMetric::get_link_etx(EtherAdd
>          >> ress const&, bool)'
>          >> threshmetric.o(.gnu.linkonce.r._ZTI15ThresholdMetric+0x8): undefined
>          >> reference to `typeinfo for GridGenericMetric'
>          >> yarvismetric.o(.text+0x5b): In function
>         `YarvisMetric::~YarvisMetric()':
>          >> ../elements/grid/gridgenericmetric.hh:17: undefined reference to
>         `vtable
>          >> for
>          >> GridGenericMetric'
>          >> yarvismetric.o(.text+0x77): In function
>         `YarvisMetric::~YarvisMetric()':
>          >> ../elements/grid/gridgenericmetric.hh:17: undefined reference to
>         `vtable
>          >> for
>          >> GridGenericMetric'
>          >> yarvismetric.o(.text+0x94): In function
>         `YarvisMetric::~YarvisMetric()':
>          >> ../elements/grid/gridgenericmetric.hh:17: undefined reference to
>         `vtable
>          >> for
>          >> GridGenericMetric'
>          >> yarvismetric.o(.gnu.linkonce.r._ZTV12YarvisMetric+0x80): undefined
>          >> reference
>          >> to
>          >> `GridGenericMetric::get_link_etx(EtherAddres
>          >> s const&, bool)'
>          >> yarvismetric.o(.gnu.linkonce.r._ZTI12YarvisMetric+0x8): undefined
>         reference
>          >> to `typeinfo for GridGenericMetric'
>          >> collect2: ld returned 1 exit status
>          >> make: *** [click] Error 1
>          >> --------------------------------------
>          >>
>          >> I have checked GridGenricMetric.hh and everything looks good. What
>         I do not
>          >> get is that it used to work well before I 'make clean'.
>          >>
>          >> If anyone has any clue about this problem or any suggestions, I
>         will really
>          >> appreciate it a lot.
>          >>
>          >> Thanks!!
>          >> Zi
>          >>
>          >>
>          >> _______________________________________________
>          >> click mailing list
>          >> click at amsterdam.lcs.mit.edu <mailto:click at amsterdam.lcs.mit.edu>
>          >> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
>          >>
>          >>
>          > _______________________________________________
>          > click mailing list
>          > click at amsterdam.lcs.mit.edu <mailto:click at amsterdam.lcs.mit.edu>
>          > https://amsterdam.lcs.mit.edu/mailman/listinfo/click
> 
> 
> 



More information about the click mailing list