Cscope: How to prevent redundant paths in database (cscope.out)?
Given the structure of my project directory is as follows,
project/
foo.h
foo.c
bar/
bar.h
bar.c
and at the beginning of 'foo.c' I included 'foo.h' (#include "foo.h").
Then in directory project I used the following steps to generate database:
> find $PWD -name "*.h" -o -name "*.c" > cscope.files
> cscope -bkq -i cscope.files
All paths in cscope.files are absolute:
/home/usr/project/foo.h
/home/usr/project/foo.c
/home/usr/project/bar/bar.h
/home/usr/project/bar/bar.c
while in cscope.out I found a relative path besides the 4 paths above, it is
foo.h
Then I cd into the bar subdirectory, vim bar.c and cs add ../cscope.out.
As a result, if I try to find some symbol defined in foo.h, I will get an
error stating "File 'foo.h' does not exist". The reason is clear because
foo.h is in the parent directory. Thus not only is this foo.h entry in
cscope.out a redundant one, but also it will generate this unpleasant
error.
How to avoid this kind of redundant and relative paths generated in
cscope.out? Is it really due to their being included as header files in
the parent directory?
No comments:
Post a Comment