leo*_*dus 10
您可以使用以下命令从llvm源树的根目录执行所需任务:
touch tags.lst
find | grep "\.c$" >> tags.lst
find | grep "\.cpp$" >> tags.lst
find | grep "\.h$" >> tags.lst
cscope -i tags.lst
Run Code Online (Sandbox Code Playgroud)
它将创建cscope.out文件,该文件与cscope一起用于浏览代码.希望能帮助到你!
列出C++项目中所有文件的便捷方法是使用ack工具:为源代码搜索优化的类似grep的命令(在某些发行版中,例如Ubuntu,调用该工具ack-grep).你可以像这样运行它:
ack -f --cpp > cscope.files
Run Code Online (Sandbox Code Playgroud)
输出是路径的所有.cpp,.h,.cc .hpp文件
我的 .bashrc 中有以下内容,这使事情变得更容易。运行cscope_build()生成数据库并cscope启动cscope工具。
# Use vim to edit files
export CSCOPE_EDITOR=`which vim`
# Generate cscope database
function cscope_build() {
# Generate a list of all source files starting from the current directory
# The -o means logical or
find . -name "*.c" -o -name "*.cc" -o -name "*.cpp" -o -name "*.h" -o -name "*.hh" -o -name "*.hpp" > cscope.files
# -q build fast but larger database
# -R search symbols recursively
# -b build the database only, don't fire cscope
# -i file that contains list of file paths to be processed
# This will generate a few cscope.* files
cscope -q -R -b -i cscope.files
# Temporary files, remove them
# rm -f cscope.files cscope.in.out cscope.po.out
echo "The cscope database is generated"
}
# -d don't build database, use kscope_generate explicitly
alias cscope="cscope -d"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
18874 次 |
| 最近记录: |