Re: c2027:Use of undefined type 'T'
 
rohinichandrap@gmail.com wrote:
I am getting the error C2027:Use of undefined type 'T' when I tried to
compile some code in visual c++7.1 that went fine in Visual c++6.0.
Below is the relevant code where the error has come.
------------------------------------------------------------------------------------------------------------------------------------
template <class T>
class MCS_PersistentList
{
public:
/* typedef std::list<T> List;*/
  typedef std::list<class T> List;/*above line modified to the current
line to resolve C2146*/
Reverse the "fix" and explain what you were trying to overcome.
  typedef List::iterator iterator;
  typedef List::const_iterator const_iterator;
Shouldn't those be
   typedef typename List::iterator iterator;
   typedef typename List::const_iterator const_iterator;
?
.
.
.
}
class MCS_ADH_Device_Cfg
{
public:
int deviceNum;
.
.
.
}
typedef MCS_PersistentList<MCS_ADH_Device_Cfg> ADH_ConfigFile;
ADH_ConfigFile::iterator it;
int x = it->deviceNum;<------Error points to this line
--------------------------------------------------------------------------------------------------------------------------------------
V
-- 
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask