0

Possible Duplicate:
Where and why do I have to put the “template” and “typename” keywords?

I am compiling Palabos with visual studio 2012. I get the following error:

Warning 1 warning C4346: 'plb::ExtractDynamicsChainFunctional2D::DMap' : dependent name is not a type c:\users\max\desktop\drawing\c++\palabos\src\dataprocessors\metastufffunctional2d.hh 100 1 Drawing

Error 2 error C2061: syntax error : identifier 'DMap' c:\users\max\desktop\drawing\c++\palabos\src\dataprocessors\metastufffunctional2d.hh 100 1 Drawing

The code causing this error is:

/* ******** ExtractDynamicsChainFunctional2D ************************************ */
template<typename T, template<typename U> class Descriptor>
ExtractDynamicsChainFunctional2D<T,Descriptor>::ExtractDynamicsChainFunctional2D (
        ExtractDynamicsChainFunctional2D<T,Descriptor>::DMap const& dynamicsMap_,
        pluint maxChainSize_ )
    : dynamicsMap(dynamicsMap_),
      maxChainSize(maxChainSize_)
{ }

My knowledge of c++ is very limited. Can somebody explain what is causing this error, and how I can fix it.

Community
  • 1
  • 1
Max Ferguson
  • 676
  • 1
  • 7
  • 25

1 Answers1

3

The error means: ExtractDynamicsChainFunctional2D<T,Descriptor>::DMap is by default not a type and cannot be used as such. If you want it to be recognised as a type, you have to put typename in front of it.

The problem occurs only inside a templated code, where you want to access a member type of another template.

CygnusX1
  • 20,968
  • 5
  • 65
  • 109