未找到 ctags:pthread_mutex_init
我已经安装了omnicppcomplete、taglist、cscope等,并且我使用以下方法在/usr/include
中生成了我的标签:
ctags -R --c++-kinds=+plx --fields=+iaS --extra=+q .
在我的.vimrc
中我设置了:
set tags=/usr/include/tags,./tags,./..tags,./**/tags
但是现在当我编写我的多线程程序时,我无法通过按 Ctrl+] 切换到 pthread_create
和 pthread_mutex_init
。它说“未找到标签”。
所以我写在这里寻求帮助。谢谢。
I have installed omnicppcomplete, taglist, cscope, etc., and I generated my tags in /usr/include
using:
ctags -R --c++-kinds=+plx --fields=+iaS --extra=+q .
And in my .vimrc
I set:
set tags=/usr/include/tags,./tags,./..tags,./**/tags
But now when I write my multi-thread programs, I can not switch to pthread_create
and pthread_mutex_init
by pressing Ctrl+]. It says "tags not found".
So I am writing here for help. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您应该查看标记文件以确定
pthread_mutex_init
和pthread_create
是否确实在其中。如果不是,则可能是 (1) 源未被扫描或 (2) 它们实际上并不以您期望的形式存在。pthread_create
和pthread_mutex_init
都包含在libc
中,这是一组非常复杂的代码,经常你会发现一个符号定义在通过多层预处理器宏的间接方式,在这种情况下 ctags 将不起作用。You should look in your tags file to determine if
pthread_mutex_init
andpthread_create
are actually in them. If they are not then it is likely that either (1) the source wasn't scanned or (2) they don't actually exist in the form you expect. Bothpthread_create
andpthread_mutex_init
are contained inlibc
, which is a very complex set of code, and often you will find that a symbol is defined in a indirect way through multiple layers of pre-processor macros, in which case ctags won't work.看看这个帖子,它可能会解决您的问题:
ctags 忽略libc6、libstdc++ 和 boost 的列表
Take a look at this SO post which will probably solve your problem:
ctags ignore lists for libc6, libstdc++ and boost
请进行如下测试,因为 ctags 需要一些 micro 来生成
sudo ctags -I THROW -I __THROWNL -I __attribute_pure -I nonnull -I __attribute -R --c-kinds= +p --fields=+iaS --extra=+q --language-force=C /usr/include/
Please test as follows because ctags need some micros to generate
sudo ctags -I THROW -I __THROWNL -I __attribute_pure -I nonnull -I __attribute -R --c-kinds=+p --fields=+iaS --extra=+q --language-force=C /usr/include/
我不知道,但是,我得到了正确的方法(ctrl+])跳转函数(pthred_create,pthred_mutex_init),只需将一些参数添加到ctags中,例如(@TerryZJ),但他的命令可能还不够,你可以使用这个:
sudo ctags -I THROW -I __THROW -I __THROWNL -I __nonnull -I __attribute_pure -I nonnull -I __attribute -R --c-kinds=+p --fields=+iaS --extra=+q - -language-force=C /usr/include/
顺便说一句,如果你不能跳转到正确的函数,你可以搜索一下声明后面是否有一些标签,例如:
如果是的话,你可能无法跳转,只需添加当您使用 ctags 时,“-I __THROWNL”。
希望对大家有用。
I have no idea but,i get the right way to (ctrl+]) jump the function(pthred_create,pthred_mutex_init),just add some parameters into ctags,like(@TerryZJ), but his command maybe is not enough,you can use this:
sudo ctags -I THROW -I __THROW -I __THROWNL -I __nonnull -I __attribute_pure -I nonnull -I __attribute -R --c-kinds=+p --fields=+iaS --extra=+q --language-force=C /usr/include/
by the way if you cannot jump to the right function,you can search if some tags is behind the declaration for example :
if so,you maybe cannot jump,just add "-I __THROWNL" when you use ctags.
hope useful to all.