关于cscope索引hpp文件的问题

发布于 2024-09-14 23:34:55 字数 309 浏览 4 评论 0原文

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

a.h

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

中,如果let

cscope -bq a.h

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

如果让的

cscope -bq a.h a.hpp

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

i have template class A, the definition is in a.hpp

a.h

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

if let

cscope -bq a.h

then cscope can find Test declaration, but cannot find definition.

if let

cscope -bq a.h a.hpp

then cscope even cannot find Test declaration.
any advice?
thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱格式化 2024-09-21 23:34:55

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

使用如图所示的代码:

ah

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

Which version of cscope on which platform?

With the code as shown:

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

and using cscope 15.7a compiled on MacOS X (running on 10.6.4, probably compiled on an earlier version), I did:

cscope -b -q a.*
cscope -d

and then searched for Test and see:

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 search for A::Test comes back with the error:

This is not a C symbol: A::Test

So, superficially, you need to upgrade to cscope 15.7a (or downgrade to it?).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文