c++ - 在 NS-2 中绑定(bind)变量时出错

标签 c++ tcl ns2

我正在使用 NS-2.35 ... 我对 AODV 协议(protocol)进行了更改以支持受控移动性。我需要将 x 和 y 位置(在执行移动性算法之后)从 C++ 传递到 TCL,然后将它们放入 (setdest) 命令中。 我在 aodv 构造函数中做了以下操作:

  bind("x_axis",&x_tcl);
  bind("y_axis",&y_tcl);

我在 ns-default.tcl 中给 x_axis 和 y-axis 一个默认值。

这就是我在 TCL 代码中使用它们的方式:

$ns at 21.0 "$node_(0) setdest $x_axis $y_axis 100.0"

但我收到以下错误:

num_nodes is set 36
warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl
INITIALIZE THE LIST xListHead
can't read "x_axis": no such variable
    while executing
"$ns at 21.0 "$node_(0) setdest $x_axis $y_axis 100.0""
    (file "eaodv.tcl" line 309)

有什么问题吗??你能帮帮我吗?

最佳答案

我认为问题出在您对 tcl 中绑定(bind)变量的使用上

$ns at 21.0 "$node_(0) setdest x_axis y_axis 100.0"

这应该有帮助 OTcl Linkage

关于c++ - 在 NS-2 中绑定(bind)变量时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29715083/

相关文章:

c++ - 在 Ubuntu 16.04 下运行协程示例给出 "' 实验/协程'文件未找到”

c++ - 语言分析的二叉树实现 - 子节点作为节点 : does not work

shell - "expect"匹配 "send"字符串,为什么?

python - Tk/Tkinter Canvas "<ItemDelete>"事件?

linux - ns-2 错误 "error when calling class $cls: $args"$...”

c++ - QSqlQuery 为列名 Sqlite 准备和绑定(bind)值

linux - 期望脚本 : Read Base64 password from file

c++ - 错误 : cannot call constructor

ns2 - NS 2.34 的 um-olsr 中存在错误?

c++ - MFC 对话框数据验证失败时恢复数据