Hi Jon, 

I have maybe a piece of solution to your question. It consists in two 
manipulations.

1°/  Add this code to your test program (as a global variable):

#include "mem-trace.h"
MemTrace *globalMemTrace = NULL;

2°/  Modify the Makefile in NS to build your new target. It should look like 
this:

test_prog: $(OBJ) module_dir/test_prog.o
        $(LINK) $(LDFLAGS) $(LDOUT)$@ \
        module_dir/test_prog.o $(OBJ) $(LIB)


Don't forget the tabulation for 2 last lines...
For the first point, if you prefer you can comment the line:
        #define MEMDEBUG_SIMULTATION
And run ./configure again

I hope this will help you.

Regards,


Benjamin

-----Message d'origine-----
De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De la part de Jon Suarez
Envoyé : mardi 18 avril 2006 13:26
À : ns-users@ISI.EDU
Objet : [ns] Compile and debug small pieces of code


Hi everyone,

 

I'm trying to compile and debug a small piece of code I have written for
ns2.

I was trying to create a main() function to check if my code works properly,
but when I compile it, an error appears: "There is another main function
before in tclAppInit file". So, I can't debug that way.

I tried creating a new makefile with only the files this main() needs, but
it needs almost all the files and it's never-ending.

Anyone could help me? I don't know how to do it. I find quite impossible
debug the code executing a simulation script. I think I should do it
starting from the C level and check that it works ok before start
simulating.

 

Any suggestions?

 

Thanks,

 

Jon Suarez

Reply via email to