Welcome to LQ.
After fifteen years of developing ns2, there may not be very much left
to debug with ordinary methods.
How can I compile the source code *.cc
Usually you cannot compile a single file in ns2.
The files.cc have headers (file.h) that will ask for other headers,
in a complex pattern: 29 different locations inside ns-2.xx with *.h .
For that you have a Makefile. ( And a Makefile.in ).
The compiler is c++ (g++): Redhat based like Fedora, CentOS + Mandriva +
PCLinuxOS + Suse : The package name is gcc-c++, providing /usr/bin/g++.
( Some "compat" compilers are available too : Search for c++ ).
Debian based : Ubuntu, Mint etc. : Package name = g++ .
( The compats are g++-** , e.g. g++-3.3 g++-4.1, g++-4.2, g++-4.3 ).