- Home Page of ProjectGuideline.com ›
- Forums ›
- Get Help to do your B.E., and M.E., M.Tech., & M.S., Project in Ns2 ›
- linking c++ in ns2
In fact you can call/use any external program during a ns2 simulation. So even you can call the compiled version of your c/c++ code from tcl scripts.
But, it is not the generic/correct way of writing a protocol/agent for a ns2 related network simulation.
If you want to write your c/c++ code, then you may incorporate them inside any of the C++ protocol/agent code of ns2. Or write them separately and create your own protocol/agent for ns2. For that you have to follow all the standards of writing a ns2 C++ code.
In other words, there can be only one “main()” function in ns2 code structure. So you can not have another one inside your C++ code.
Sorry for confusing you. – In fact, it may take some time to explore and feel the beauty of ns2 and its C++-Tcl duality nature, and of course, may take years to fully understand and practice/use this.