bnsk
bnsk

Reputation: 131

Using ctags and cscope

I did a ctags -R on my project which is in c++, in the directory /project/ntopng. Now, when I start cscope using cscope -R and search for main.cpp, it opens up. But, when I hit ctrl-] on #include "ntop-includes.h" in main.cpp, the error message is tag not found. The header file is inside a sub-directory in /project/ntopng/include. But, ctags -R is recursive so why is it that I am getting an error? I am using Ubuntu 12.04 with the latest version of ctags and cscope. Thank You.

Upvotes: 0

Views: 2060

Answers (1)

user2866978
user2866978

Reputation: 11

I have given the below answer for Ubuntu 12.04

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

If it is not the expected tag file path type: :set tags=path_to_your_tag_file (ex /project/ntopng/tags)

Remember it is valid for the current session only, Now if permanent changes required there are two options.

For All users (requires root privileges) --

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

For the individual user:

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

Let me know if it worked for you.

Upvotes: 1

Related Questions