Welcome to LQ.
You are probably trying to compile 'ns-allinone-2.34'. ?
The requirements for Ubuntu are :
sudo apt-get install libx11-dev libxmu-dev libxmu-headers libxt-dev libtool
And please read other LQ threads from users of ns2.
> > LQ 'Search' > "Tag Name" = ns2 . ( e.g. 6 months back.)
You will find examples and links to examples + documentation.