First update all pending updates to the OS.

Then install the development files for X Windows plus the g++ compiler:
sudo apt-get install xorg-dev g++ xgraph

And finally edit linkstate/ls.h line 137 to read

void eraseAll() { this->erase(baseMap::begin(), baseMap::end()); }

Then you are set to run ./install from the main catalog of ns-2.35