ctags problem when generating tags for .h and .c file in two different directory
Now I have two directory, all of header files *.h are included in directory /inc, while all of c file *.c are stored in /src directory.
开发者_如何学JAVAThe directory just like this, (/project is a up level directory):
/project-- |----/inc
           |----/src
I want to use ctrl+] to locate definition of one parameter or one function in a source file like example.c. How to generate those tags?
My method is:
(1) cd to the /project directory
(2) ctags inc/*.h src/*.c
Then a tags file is generated there, however, when I open a example file and using "Ctrl+]", it cannot lead me to its definition. Why???
Do I need to generate a tags file under /src???
Any help? Many thanks!
In vim, try typing:
- :pwd
- :set tags
Verify that the path to your tagfile is present in output of 2, relative to the path that is the output of 1.
NOTE: You can set the tags variable as part of your local .vimrc.
UPDATE: It is common to set tags to a pattern like tags,../tags,../../tags.  With this pattern, vim will use the first tags file that it finds your folder structure (again relative to your pwd).
Go to /project, and use the command "ctags -R ." In your .vimrc, put the command "set tags=/project/tags". Exit vim and enter it again. Tags should now work.
 
         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论