[Click] Questions about HashMap

Xiaojun Feng fightfxj at gmail.com
Fri Mar 27 02:33:41 EDT 2009


Hi all,

I have an question about HashMap in Click.

I defined a HashMap as follows:

class DataType
{
public:
      DataType(uint8_t* data, uint32_t size) : data(data), size(size) {}
      ~DataType() {delete[] data;}
      const uint8_t * GetData() {return data;}
      uint32_t GetSize() {return size;}
private:
      uint8_t* data;
      uint32_t size;
}

typedef DataType* DataPtr;

typedef HashMap<uint32_t, DataPtr> DataMap

DataMap datas;

and I will use the following functions of HashMap:

insert() and DataMap::iterator

but when I try to compile the program, there are some errors:

/media/work/fightfxj/thesis/linux_program/click-1.6.0/userlevel/../include/click/bighashmap.hh:424:
undefined reference to `HashMap<unsigned int, void*>::HashMap()'
PacketSender.o: In function `~HashMap':
/media/work/fightfxj/thesis/linux_program/click-1.6.0/userlevel/../include/click/bighashmap.hh:428:
undefined reference to `HashMap<unsigned int, void*>::~HashMap()'
PacketSender.o: In function `HashMap':
/media/work/fightfxj/thesis/linux_program/click-1.6.0/userlevel/../include/click/bighashmap.hh:424:
undefined reference to `HashMap<unsigned int, void*>::HashMap()'
RtpPacketDecoder.o: In function `HashMap<unsigned int,
DataPacket*>::insert(unsigned int const&, DataPacket*)':
/media/work/fightfxj/thesis/linux_program/click-1.6.0/userlevel/../include/click/bighashmap.hh:449:
undefined reference to `HashMap<unsigned int, void*>::insert(unsigned int
const&, void*)'
RtpPacketDecoder.o: In function `_HashMap_const_iterator':
/media/work/fightfxj/thesis/linux_program/click-1.6.0/userlevel/../include/click/bighashmap.hh:495:
undefined reference to `_HashMap_const_iterator<unsigned int,
void*>::_HashMap_const_iterator(HashMap<unsigned int, void*> const*, bool)'
RtpPacketDecoder.o: In function `_HashMap_const_iterator<unsigned int,
void*>::operator++()':
/media/work/fightfxj/thesis/linux_program/click-1.6.0/userlevel/../include/click/bighashmap.hh:315:
undefined reference to `_HashMap_const_iterator<unsigned int,
void*>::operator++(int)'
RtpPacketDecoder.o: In function `_HashMap_const_iterator':
/media/work/fightfxj/thesis/linux_program/click-1.6.0/userlevel/../include/click/bighashmap.hh:495:
undefined reference to `_HashMap_const_iterator<unsigned int,
void*>::_HashMap_const_iterator(HashMap<unsigned int, void*> const*, bool)'
collect2: ld returned 1 exit status
make[1]: *** [click] Error 1
make[1]: Leaving directory
`/media/work/fightfxj/thesis/linux_program/click-1.6.0/userlevel'


Does anyone know what's wrong with it and  how to fix it?

Thanks in advance!

-- 
Xiaojun Feng


More information about the click mailing list