繁体   English   中英

有关cscope索引hpp文件的问题

[英]problem about cscope index hpp file

我有模板类A,定义在a.hpp中

template <...>
A
{
void Test();
};
#include a.hpp

如果让

cscope -bq a.h

那么cscope可以找到Test声明,但是找不到定义。

如果让

cscope -bq a.h a.hpp

那么cscope甚至找不到Test声明。 有什么建议吗? 谢谢。

在哪个平台上哪个版本的cscope?

用如下所示的代码:

#ifndef A_H_INCLUDED
#define A_H_INCLUDED
template <class T> A
{
    void Test(T a);
};
#include "a.hpp"
#endif /* A_H_INCLUDED */

hpp

#ifndef A_HPP_INCLUDED
#define A_HPP_INCLUDED
template <class T> A::Test(T a) { return !!a; }
#endif /* A_HPP_INCLUDED */

并使用在MacOS X上编译的cscope 15.7a(在10.6.4上运行,可能在较早版本上编译),我做到了:

cscope -b -q a.*
cscope -d

然后搜索“测试”,然后查看:

C symbol: Test

  File  Function Line
0 a.h   <global> 5 void Test(T a);
1 a.hpp Test     3 template <class T> A::Test(T a) { return !!a; }

搜索A::Test会返回错误:

This is not a C symbol: A::Test

因此,从表面上看,您需要升级到cscope 15.7a(或降级到它)?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM