ubuntu snavigator查看源代码工具安装方法

ubuntu下的安装方式是:

一、 手动安装最新版本
1)到官方网站获取软件包
http://sourceforge.net/project/showfiles.php?group_id=51180
2)解压缩
tar zxvf s ourcenav-6.0.tar.gz
./configure
make
make install
ps:如果出现权限问题,前面加sudo
3)如果碰到下述错误
/root/tk8.4.16/unix/../generic/tk3d.c:1279: error: ‘TkBorder’ has no member named ‘resourceRefCount’
/root/tk8.4.16/unix/../generic/tk3d.c:1280: error: ‘Tk_FakeWin’ has no member named ‘display’
/root/tk8.4.16/unix/../generic/tk3d.c:1280: error: ‘Tk_FakeWin’ has no member named ‘screenNum’
/root/tk8.4.16/unix/../generic/tk3d.c:1280: error: ‘TkBorder’ has no member named ‘screen’
/root/tk8.4.16/unix/../generic/tk3d.c:1281: error: ‘Tk_FakeWin’ has no member named ‘atts’
/root/tk8.4.16/unix/../generic/tk3d.c:1281: error: ‘TkBorder’ has no member named ‘colormap’
/root/tk8.4.16/unix/../generic/tk3d.c:1301: error: ‘TkDisplay’ has no member named ‘borderTable’
/root/tk8.4.16/unix/../generic/tk3d.c:1301: error: ‘TkDisplay’ has no member named ‘borderTable’
/root/tk8.4.16/unix/../generic/tk3d.c:1306: error: ‘TkBorder’ has no member named ‘nextPtr’
。。。。。。
则在终端是输入:sudo apt-get install libx11-dev

4) 启动snavigator
在终端直接输入:snavigator

运行$snavigator
出现 :
Can't find a usable tk.tcl in the following directories: 
    /usr/local/share/tk8.3
 
/usr/local/share/tk8.3/tk.tcl: no event type or button # or keysym
no event type or button # or keysym
    while executing
"bind Listbox <MouseWheel> {
    %W yview scroll [expr {- (%D / 120) * 4}] units
}"
    (file "/usr/local/share/tk8.3/listbox.tcl" line 182)
    invoked from within
"source [file join $tk_library listbox.tcl]"
    invoked from within
"if {[string compare $tcl_platform(platform) "macintosh"] && \
 [string compare {} $tk_library]} {
    source [file join $tk_library button.tcl]
    so..."
    (file "/usr/local/share/tk8.3/tk.tcl" line 308)
    invoked from within
"source /usr/local/share/tk8.3/tk.tcl"
    ("uplevel" body line 1)
    invoked from within
"uplevel \#0 [list source $file]"
 
 This probably means that tk wasn't installed properly.
注意第10行:file “/usr/local/share/tk8.3/listbox.tcl” line 182
于是注释掉182~184三行

再运行$snavigator
又出现:
Can't find a usable tk.tcl in the following directories: 
    /usr/local/share/tk8.3
 
/usr/local/share/tk8.3/tk.tcl: no event type or button # or keysym
no event type or button # or keysym
    while executing
"bind Text <MouseWheel> {
    %W yview scroll [expr {- (%D / 120) * 4}] units
}"
    (file "/usr/local/share/tk8.3/text.tcl" line 457)
    invoked from within
"source [file join $tk_library text.tcl]"
    invoked from within
"if {[string compare $tcl_platform(platform) "macintosh"] && \
 [string compare {} $tk_library]} {
    source [file join $tk_library button.tcl]
    so..."
    (file "/usr/local/share/tk8.3/tk.tcl" line 308)
    invoked from within
"source /usr/local/share/tk8.3/tk.tcl"
    ("uplevel" body line 1)
    invoked from within
"uplevel \#0 [list source $file]"
 
 This probably means that tk wasn't installed properly.
同理,注意第11行:file “/usr/local/share/tk8.3/text.tcl” line 457
注释掉457~459行就可以正常运行了。


5) 使用手册(user manual)
http://sourcenav.sourceforge.net/online-docs/userguide/index_ug.html
Enjoy it :)

二、系统自动下载安装方式(测试过不行)
        sudo apt-get install sourcenav
运行方式是:
        snavigator


源代码查看工具 Source Navigator 使用心得:
      Source Navigator 是Red Hat出品的一款查看源代码的工具,非常好用,与Windows下的Source Insight有一敌。但是它的界面不怎么好看,用的不是GTK图形库,所以界面风格与Gnome不一致,操作上也有些不同。除了这些,其它功能都非常强大,细数如下。
里面的一些简写约定如下:
Code Area
cl Classes
con Constants
e Enums
ec Enum Values
fd Function Declarations
fr friends
fu Functions
gv Global Variables
iv Instance Variables
ma Macros
md Method Definitions
mi Method Implementations
t Typedefs
un Unions
lv Local variables
ud Undefined
Cross-Reference
r Read
w Written
p Passed
u Unused
SNav的代码窗口有6个标签页,它们分别是
“Edit”
“Hierarchy”
“Class”
“Xref”
“Retriever”
“Grep”
      其中,“Edit”区是代码显示和修改的区域,是工作的主要区域;“Hierarchy”和“Class”是C++代码的组织工具;  “Xref”是最强大的一个工具,它会把一个函数中的所有用到的变量,调用的函数,用到的结构全记录并展现出来;“Retriever”也是一个非常有用的工具,用于把一个库代码包中的所有定义的符号列出来,并记录相应的属性;“Grep”用于查找某一个符号,可指定搜索的范围,既可全局查找也可部分文件查找。
 
阅读代码时常用到的一些键值组合:
Ctrl+leftarrow | rightarrow | uparrow | downarrow 以词的形式移动光标
Ctrl+Alt+leftarrow | rightarrow | uparrow | downarrow 以词的形式移动光标并选择走过的区域
Ctrl+Shift+D 查看选定符号的声明
Ctrl+Shift+I 查看选定符号的定义
代码窗口的工具栏上有7个元素,分别是
“回退跳转”
“前进跳转”
“光标处所在的函数名或结构名”
“选定并要操作(比如查找)的字符串”
“在本文件中查找选定的字符串”(比Ctrl+F查找功能好使)
“在整个工程中查找与选定字符串匹配的代码”
“在整个工程中以Grep的方式查找与选定字符串匹配的代码”(会跳到Grep标签页中显示结果)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值