Amazing technological breakthrough possible @S-Logix

Office Address

  • 2nd Floor, #7a, High School Road, Secretariat Colony Ambattur, Chennai-600053 (Landmark: SRM School) Tamil Nadu, India
  • +91- 81240 01111

Social List

How to compile c++ code in NS2?


To compile a C++ file, the network simulator calls g++ compiler with the filename containing the C++ code. In following example, file can be executed by the g++ command. The output of creates an object file called main.o.

Sample Code

#include <iostream>
using namespace std;
int main (void)
{ int a = 10;
cout << "The value of a is: " << a << endl;
return 0;
g++ -o main