在 Ubuntu 中如何消除这个错误?
set tracefile [open out.tr w]
$ns trace-all $namfile
当我运行上面的 TCL 代码时,它会显示在终端中。我刚开始学习TCL所以不知道该怎么办这个错误。
can't read "namfile": no such variable
while executing
"$ns trace-all $namfile"
set tracefile [open out.tr w]
$ns trace-all $namfile
When I am running the above TCL code this is showing in terminal. I have just started learning TCL so don't know what to do anything this error.
can't read "namfile": no such variable
while executing
"$ns trace-all $namfile"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
错误消息非常清楚:当代码
$ns trace-all $namfile
运行时,未设置名为namfile
的变量。我无法从您提供的代码片段中看出原因; 也许这是因为您应该使用$tracefile
来代替,或者也许您应该将namfile
设置为某些内容但没有这样做?或者甚至可能是更复杂的事情。 (我也不知道您是否应该为trace-all
方法提供通道或文件名;您应该查找一下。)The error message is pretty clear: the variable called
namfile
is not set at the point when the code$ns trace-all $namfile
is run. I can't tell why from the snippet you provided; maybe it's because you should have used$tracefile
instead, or maybe you should setnamfile
to something and haven't done so? Or even possibly something more complicated. (I also don't know whether you're supposed to give a channel or a filename to thetrace-all
method; you should look that up.)