Tcl .错误消息错误“args:应为”;对于“启动测试下一个命令”;即将到来

Tcl .错误消息错误“args:应为”;对于“启动测试下一个命令”;即将到来,tcl,ns2,Tcl,Ns2,尝试运行以下代码时,我收到错误消息错误#args:应为“for start test next command: proc finish {} { global ns nf $ns flush-trace #Close the trace file close $nf #Execute nam on the trace file exec nam out.nam & exit 0 } #Cr

尝试运行以下代码时,我收到错误消息
错误#args:应为“for start test next command

proc finish {} {
        global ns nf
        $ns flush-trace
    #Close the trace file
        close $nf
    #Execute nam on the trace file
        exec nam out.nam &
        exit 0
}

#Create 50 nodes

for {set i 0} {$i<51} {incr i} {

set n($i) [$ns node]
}

#Create a duplex link between the nodes
$ns duplex-link $n0 $n1 1Mb 10ms DropTail
proc finish{}{
全局ns nf
$ns刷新跟踪
#关闭跟踪文件
收盘价$nf
#在跟踪文件上执行nam
执行长nam out.nam&
出口0
}
#创建50个节点

对于{set i0}{$I分配给变量
ns
?该代码与您输入的代码完全相同吗?例如,您不能将for语句代码块的左括号放在单独的一行上。粘贴的代码看起来不错。我同意@patthoyts,但代码是否会产生带有该错误的Tcl堆栈跟踪?这些通常都是非常有用的信息。(如果没有-可能是因为您正在使用
catch
捕获它,或者您正在交互工作-堆栈跟踪将位于
errorInfo
全局变量中。)请注意,循环将创建51个节点,编号从0到50。