Hi, I have a problem with a compiler error "invalid use of incomplete type". Here is the description:
in "first.h", I have:
in "first.C", I have:
in "second.H", I have:
and in "second.C", I have:
at the last line I get an error that
error: invalid use of incomplete type ‘struct generic_cache_t emplate<generic _cache_block_t> ’
I have searched about this error and some say it is occurred because of something called forward deceleration (a function is called but the
class has not been instantiated yet). I doubt about existence of such issue. Any idea is appreciated.
in "first.h", I have:
Code:
class cache_t {
public:
virtual void printStats( pseq_t *pseq );
...
};
class generic_cache_block_t {
...
};
Code:
template class generic_cache_template<generic_cache_block_t>;
...
void cache_t::printStats( pseq_t *pseq )
{
....
}
in "second.H", I have:
Code:
generic_cache_template<generic_cache_block_t> *l2_cache; ....
Code:
l2_cache->printStats( this ); [B]//error[/B]
error: invalid use of incomplete type ‘struct generic_cache_t emplate<generic _cache_block_t> ’
I have searched about this error and some say it is occurred because of something called forward deceleration (a function is called but the
class has not been instantiated yet). I doubt about existence of such issue. Any idea is appreciated.
Comment