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

Re: [ns] How to add new file to compiler in ns2??



In Makefile.in you must only add Myfile.o to the source ns-packets.

like:

OBJ_CC = \
 random.o rng.o ranvar.o misc.o timer-handler.o \
.....
.....
 mpls/classifier-addr-mpls.o mpls/ldp.o mpls/mpls-module.o \
 rtmodule.o classifier-hier.o addr-params.o \
 Myfile.o \
 $(OBJ_STL)

make is smart enough to find out how to make .o files.

In your Myfile.h you should include any .h files you might need, like:

#ifndef myfile_h
#define myfile_h

#include "agent.h"
#include "tclcl.h"
#include "packet.h"
#include "address.h"
#include "ip.h"
#include "queue.h"
#include "message.h"

#include <stdio.h>


Yi-Hsien Tseng wrote:

> Hi all:
>         If I have wrote new class in new file.
>         I want to write it  into Makefile.
>         I add myfile.o: myfile.h ........etc!
>         But I see other file may relate with many other files
>
>         My question is how do I know which file I need add to
>         Myfile.o: Myfile.h [which files??]