Using ctags and cscope

Using ctags and cscope

本文关键字:cscope and ctags Using      更新时间:2023-10-16

我在c ++中的项目上做了一个ctags -R,在目录/project/ntopng中。现在,当我使用 cscope -R 启动 cscope 并搜索 main.cpp 时,它会打开。但是,当我在 main.cpp 中的 #include"ntop-include.h"上按 ctrl-] 时,找不到错误消息。头文件位于/project/ntopng/include 的子目录中。但是,ctags -R 是递归的,为什么我会收到错误?我正在使用带有最新版本的 ctags 和 cscope 的 Ubuntu 12.04。谢谢。

我给出了以下答案Ubuntu 12.04

1. Open any file with vim
2. type :echo &tags ,It will show what path vim is using for tags file.

如果不是预期的标记文件路径类型: :set tags=path_to_your_tag_file (ex /project/ntopng/tags)

请记住,它仅对当前会话有效,现在如果需要永久更改,则有两个选项。

对于所有用户(需要根权限) --

1. cd /etc/vim
2. vim vimrc
3. Go to end and add set tags+=tags;path_to_your_tag_file

对于个人用户:

1. cd ~
2. vim .vimrc    (This file may not exists in that case newly created)
3. set tags+=tags;path_to_your_tag_file

让我知道它是否适合您。