tags:

views:

25

answers:

1

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.

A: 

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?).

Jonathan Leffler
my cscope is 15.5, it seems i should upgrade. thank you.
Raymond