- Home Page of ProjectGuideline.com ›
- Forums ›
- Guidelines for Learning ns2 ›
- new user
hello
I am a beginner of ns2, i would like to ask a simple question. in ns2, there is file .h , .cc and also .o with the same file name (example : sensornode.h ,sensornode.cc, sensornode.o). i would to know if the file is related to each other and what different between these three file and file . h for what?, file .cc for what and also file .o for what.
really hope you can help me 😀
While compiling ns2, finally, it(the make command) will generate a binary executable file in the name “ns”. If you run that command you will have % prompt. (just similar to a tcl shell prompt).
Ok.
ns is made up of thousands of such individual C++ files (*.cc)
In C++ (and in c) there is a convention that the some constants, variables, function prototypes and the class objects were declared in a header file(*.h) with the same name of the c++ file which will use those constants, variables, functions and classes.
While compiling(making) ns2 using make command, all those refereed C++ files will get compiled individually and the corresponding, generated object files (binary) will be finally linked (using the linker) which will produce the final binary file “ns” (in windows, it will be ns.exe)
Note :
You can not use them (C++/h) separately just like a normal C program which you will write in your C++ practicals class/lab. You can not run them individually since there will not be “main()” function in those separate code segments.