NS-2.27+LEACH test failure problem solved

The last post of my work log summrized the instructions for implementing LEACH on NS-2.27 on Ubuntu 7.04 operating system. But, I didn't noticed the LEACH test was actually failed due to the error below:

invalid command name "Resource/Energy"
while executing
"Resource/Energy instproc setParams {args} {
$self instvar energyLevel_ alarmLevel_
set energyLevel_ [lindex $args 0]
set alarmLevel_ [lind..."
(file "/home/ran/ns- allinone-2.27/ns-2.27/mit/rca/resources/ns-energy-resource.tcl" line 13)
invoked from within
"source.orig /home/ran/ns-allinone-2.27/ns-2.27/mit/rca/resources/ns-energy-resource.tcl"
("uplevel" body line 1)
invoked from within
"uplevel source.orig [list $fileName]"
invoked from within
"if [$instance_ is_http_url $fileName] {
set buffer [$instance_ read_url $fileName]
uplevel eval $buffer
} else {
uplevel source.orig [list $fileName]
(procedure "source" line 8)
invoked from within
"source $env(RCA_LIBRARY)/resources/ns-energy-resource.tcl"
(file " uamps.tcl" line 18)

The problem was also reported by a guy to ISI NS mailing list one month earlier(Apr.2007) but no reply. So I was trying to solve it myself. Actually I tried to use Cygwin under windows, but frankly that brought more problems. And I tried to install Ubuntu 7.04 freshly. And I installed NS-2.27 and LEACH by exactly following the instructions in the previous post. And then, guess what! The LEACH test is passed, with no error.

I guess the problem maybe lies in my gcc. In Ubuntu 7.04, the version of gcc is 4.1.2, and the gcc version of Ubuntu 6.10 is 4.1.1. Although I've updated my system to 7.04, but I failed to update the source.list(I only followed through the "new distribution available" buttion in the synaptic package manager. Didn't really run sudo apt-get dist-upgrade and sudo apt-get upgrade), so perhaps *something* was missing during the update procedure. Perhaps the LEACH code do not work with gcc 4.1.1 ? But this's only my idea, not proven to be correct. Comments are welcome as always.