Ubuntu Linux 9.10 安装NS2笔记(5)

输入下面命令运行:
ns example1.tcl
报错为:

yyang@Lakewalker:~/ns$ nam:
[code omitted because of length]
: no event type or button # or keysym
    while executing
"bind Listbox <MouseWheel> {
%W yview scroll [expr {- (%D / 120) * 4}] units
}"
    invoked from within
"if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
bind Listbox <MouseWheel> {
%W yview scroll [expr {- (%D)}] units
}
bind Li..."

上网查找解决办法,发现两个网站:

?id=225999
在它们的帮助,成功解决问题!

报错的原因在于ns2.33中,nam调用的tk组件和xproto-7.0.13不兼容,因此要打补丁,解决步骤如下:
1、新建一个文档,名为“tk-8.4-lastevent.path”,并将以下内容复制到其中:
--- generic/tk.h.orig    2008-02-06 16:31:40.000000000 +0100
+++ generic/tk.h    2008-07-24 08:21:46.000000000 +0200
@@ -635,17 +635,15 @@
  *
  *---------------------------------------------------------------------------
  */
-#define VirtualEvent        (LASTEvent)
-#define ActivateNotify        (LASTEvent + 1)
-#define DeactivateNotify    (LASTEvent + 2)
-#define MouseWheelEvent     (LASTEvent + 3)
-#define TK_LASTEVENT        (LASTEvent + 4)
+#define VirtualEvent        (MappingNotify + 1)
+#define ActivateNotify        (MappingNotify + 2)
+#define DeactivateNotify    (MappingNotify + 3)
+#define MouseWheelEvent     (MappingNotify + 4)
+#define TK_LASTEVENT        (MappingNotify + 5)
 
 #define MouseWheelMask        (1L << 28)
-
 #define ActivateMask        (1L << 29)
 #define VirtualEventMask    (1L << 30)
-#define TK_LASTEVENT        (LASTEvent + 4)
 
 
         COLORMAP,
            0,
            0,
+#ifdef GenericEvent
+             0,
+#endif
            VIRTUAL,
            ACTIVATE,       
            ACTIVATE,

保存后,将tk-8.4.18-tkBind.patch置于ns-allinone-2.33下,即进行如下操作:
cd /home/yyang
sudo cp tk-8.4.18-tkBind.patch
/home/yyang/ns-allinone-2.33
cd /home/yyang/ns-allinone-2.33
patch -p0 <tk-8.4.18-tkBind.patch

最后,重新安装

cd /home/yyang/ns-allinone-2.33
sudo ./install

Ubuntu Linux 9.10 安装NS2笔记

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/27719.html