【问题标题】:problem about cscope index hpp filecscope索引hpp文件的问题
【发布时间】:2010-08-18 03:31:39
【问题描述】:

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

啊。

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

如果让

cscope -bq a.h

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

如果让

cscope -bq a.h a.hpp

然后 cscope 甚至找不到测试声明。 有什么建议吗? 谢谢。

【问题讨论】:

  • '#include'行的语法无效...

标签: c++ cscope


【解决方案1】:

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

代码如图:

啊.h

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

a.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

然后搜索Test看看:

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(或降级到它?)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-11-02
    • 2018-06-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多