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

Re: [ns] new headers




you probably also need to change, ns-packet.tcl
i think, the documentation explains that.

	-ratul

On Mon, 16 Oct 2000, Debojyoti Dutta wrote:

> Hi,
> 
> I defined a header like this:
> 
> struct hdr_x{
> 
>         int x_;
>         int& x(){ return x_; }
> 
> 	static int offset_;	// offset for this header
> 
> 	inline static int& offset() { return offset_; }
> 	inline static hdr_ebn* access(Packet* p) {
> 		return (hdr_ebn*) p->access(offset_);
> 	}
> 
> };
> 
> And then defined the OTcl clas like:
> 
> static class XHeaderClass : public PacketHeaderClass {
> public:
>         XHeaderClass() : PacketHeaderClass("PacketHeader/X",
>                                              sizeof(hdr_x)) {
>                 bind_offset(&hdr_x::offset());
>         }
> } class_xhdr;
> 
> On compiling, it doesnt give errors. On linking it gives the following it
> gives:
> 
> proto-x.o: In function `hdr_x::offset(void)':
> proto-x.o(.hdr_x::gnu.linkonce.t.offset(void)+0x4): undefined reference
> to `hdr_x::offset_'
> collect2: ld returned 1 exit status
> make: *** [ns] Error 1
> 
> 
> Help will be appreciated 
> 
> Debo
> 
>