[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns] SoS: Undefined symbol _10hdr_simple.offset_ error



Hello Haobo,

I am getting a error linking error

Undefined                       first referenced
 symbol                             in file
_10hdr_simple.offset_               simpleagent.o

Here is how I have coded my SimpleAgent

<file: simpleagent.h>
#define HDR_SIMPLE(p) (hdr_simple::access(p))

struct hdr_simple {
  char ret;
  static int offset_;
  inline static hdr_simple * access(Packet *p) {
      return (hdr_simple *) p->access(offset_);
  };
};

class SimpleAgent : public Agent {
...
};

And in the file:simpleagent.cc

#include "simpleagent.h"
..

static class SimpleHeaderClass : public PacketHeaderClass {
public:
        SimpleHeaderClass() : PacketHeaderClass("PacketHeader/Simple",
                                             sizeof(hdr_simple))
        {
             printf("SimpleHeader::Constructor\n");
             bind_offset(&hdr_simple::offset_);
        }
} class_simplehdr;


and in recv function I get try to get the access to my packetheader

struct hdr_simple *sh = HDR_SIMPLE(p);


Please tell me what I could be doing wrong, I have a project submission
due tomorrow. It was working fine when I had used 'off_simple_' defined in
the SimpleAgent class, but I need to access the offset_ from other
classes.

Thanks in anticipation.

Regards,
Sudhin.

****************** Sudhindra Suresh Bengeri *******************
School:                       | Home:                         |
Dept. of Computer Science     | 2502, Avent Ferry Rd          |
NCSU, Raleigh, NC.            | Apt #206, Raleigh, NC - 27606 |
Ph. 919 515 7135(TA room)     | Ph. 919 838 8746              |     
my web projection: http://www4.ncsu.edu/~ssbenger