i have written my own collection class,some errors
-
.h file........................ #if !defined(AFX_STREAM_H__76EBFBD3_73B0_11D7_9C8F_0050BA3C5F89__INCLUDED_) #define AFX_STREAM_H__76EBFBD3_73B0_11D7_9C8F_0050BA3C5F89__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 class CStream:public CObject { public: CStream(); CStream(CString &strName,CString &strAge,CString &strDep,CString &strNo); virtual ~CStream(); CString m_strName; CString m_strAge; CString m_strDep; CString m_strNo; }; class CStreams:public CList { public: CStream * Find(CString& sIDStream); CStreams(); virtual ~CStreams(); void AddStream(CString& sName, CString& sAge,CString &sDep,CString &sNo); }; #endif // !defined(AFX_STREAM_H__76EBFBD3_73B0_11D7_9C8F_0050BA3C5F89__INCLUDED_) THIS R THE ERRORS I GOT PLEASE HELP ME i have given the implementation in .cpp file also........... this r the errors............. Compiling... CStream.cpp e:\getstart\cllectdlg\cstream.h(27) : error C2504: 'CList' : base class undefined e:\getstart\cllectdlg\cstream.h(27) : error C2143: syntax error : missing ',' before '<' e:\getstart\cllectdlg\cstream.h(27) : error C2059: syntax error : '<' E:\GetStart\Cllectdlg\CStream.cpp(61) : error C2065: 'AddTail' : undeclared identifier Error executing cl.exe. Cllectdlg.exe - 4 error(s), 0 warning(s)
-
.h file........................ #if !defined(AFX_STREAM_H__76EBFBD3_73B0_11D7_9C8F_0050BA3C5F89__INCLUDED_) #define AFX_STREAM_H__76EBFBD3_73B0_11D7_9C8F_0050BA3C5F89__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 class CStream:public CObject { public: CStream(); CStream(CString &strName,CString &strAge,CString &strDep,CString &strNo); virtual ~CStream(); CString m_strName; CString m_strAge; CString m_strDep; CString m_strNo; }; class CStreams:public CList { public: CStream * Find(CString& sIDStream); CStreams(); virtual ~CStreams(); void AddStream(CString& sName, CString& sAge,CString &sDep,CString &sNo); }; #endif // !defined(AFX_STREAM_H__76EBFBD3_73B0_11D7_9C8F_0050BA3C5F89__INCLUDED_) THIS R THE ERRORS I GOT PLEASE HELP ME i have given the implementation in .cpp file also........... this r the errors............. Compiling... CStream.cpp e:\getstart\cllectdlg\cstream.h(27) : error C2504: 'CList' : base class undefined e:\getstart\cllectdlg\cstream.h(27) : error C2143: syntax error : missing ',' before '<' e:\getstart\cllectdlg\cstream.h(27) : error C2059: syntax error : '<' E:\GetStart\Cllectdlg\CStream.cpp(61) : error C2065: 'AddTail' : undeclared identifier Error executing cl.exe. Cllectdlg.exe - 4 error(s), 0 warning(s)
-
.h file........................ #if !defined(AFX_STREAM_H__76EBFBD3_73B0_11D7_9C8F_0050BA3C5F89__INCLUDED_) #define AFX_STREAM_H__76EBFBD3_73B0_11D7_9C8F_0050BA3C5F89__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 class CStream:public CObject { public: CStream(); CStream(CString &strName,CString &strAge,CString &strDep,CString &strNo); virtual ~CStream(); CString m_strName; CString m_strAge; CString m_strDep; CString m_strNo; }; class CStreams:public CList { public: CStream * Find(CString& sIDStream); CStreams(); virtual ~CStreams(); void AddStream(CString& sName, CString& sAge,CString &sDep,CString &sNo); }; #endif // !defined(AFX_STREAM_H__76EBFBD3_73B0_11D7_9C8F_0050BA3C5F89__INCLUDED_) THIS R THE ERRORS I GOT PLEASE HELP ME i have given the implementation in .cpp file also........... this r the errors............. Compiling... CStream.cpp e:\getstart\cllectdlg\cstream.h(27) : error C2504: 'CList' : base class undefined e:\getstart\cllectdlg\cstream.h(27) : error C2143: syntax error : missing ',' before '<' e:\getstart\cllectdlg\cstream.h(27) : error C2059: syntax error : '<' E:\GetStart\Cllectdlg\CStream.cpp(61) : error C2065: 'AddTail' : undeclared identifier Error executing cl.exe. Cllectdlg.exe - 4 error(s), 0 warning(s)
Did you include
afxtempl.h
? -
.h file........................ #if !defined(AFX_STREAM_H__76EBFBD3_73B0_11D7_9C8F_0050BA3C5F89__INCLUDED_) #define AFX_STREAM_H__76EBFBD3_73B0_11D7_9C8F_0050BA3C5F89__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 class CStream:public CObject { public: CStream(); CStream(CString &strName,CString &strAge,CString &strDep,CString &strNo); virtual ~CStream(); CString m_strName; CString m_strAge; CString m_strDep; CString m_strNo; }; class CStreams:public CList { public: CStream * Find(CString& sIDStream); CStreams(); virtual ~CStreams(); void AddStream(CString& sName, CString& sAge,CString &sDep,CString &sNo); }; #endif // !defined(AFX_STREAM_H__76EBFBD3_73B0_11D7_9C8F_0050BA3C5F89__INCLUDED_) THIS R THE ERRORS I GOT PLEASE HELP ME i have given the implementation in .cpp file also........... this r the errors............. Compiling... CStream.cpp e:\getstart\cllectdlg\cstream.h(27) : error C2504: 'CList' : base class undefined e:\getstart\cllectdlg\cstream.h(27) : error C2143: syntax error : missing ',' before '<' e:\getstart\cllectdlg\cstream.h(27) : error C2059: syntax error : '<' E:\GetStart\Cllectdlg\CStream.cpp(61) : error C2065: 'AddTail' : undeclared identifier Error executing cl.exe. Cllectdlg.exe - 4 error(s), 0 warning(s)
as the others said, the header file for CList is not included if you want to have an example of working with templates of collections take a look to the Smart Lists in: Simon Huge's article[^] My Article[^]
Greetings. -------- M.D.V. If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
-
.h file........................ #if !defined(AFX_STREAM_H__76EBFBD3_73B0_11D7_9C8F_0050BA3C5F89__INCLUDED_) #define AFX_STREAM_H__76EBFBD3_73B0_11D7_9C8F_0050BA3C5F89__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 class CStream:public CObject { public: CStream(); CStream(CString &strName,CString &strAge,CString &strDep,CString &strNo); virtual ~CStream(); CString m_strName; CString m_strAge; CString m_strDep; CString m_strNo; }; class CStreams:public CList { public: CStream * Find(CString& sIDStream); CStreams(); virtual ~CStreams(); void AddStream(CString& sName, CString& sAge,CString &sDep,CString &sNo); }; #endif // !defined(AFX_STREAM_H__76EBFBD3_73B0_11D7_9C8F_0050BA3C5F89__INCLUDED_) THIS R THE ERRORS I GOT PLEASE HELP ME i have given the implementation in .cpp file also........... this r the errors............. Compiling... CStream.cpp e:\getstart\cllectdlg\cstream.h(27) : error C2504: 'CList' : base class undefined e:\getstart\cllectdlg\cstream.h(27) : error C2143: syntax error : missing ',' before '<' e:\getstart\cllectdlg\cstream.h(27) : error C2059: syntax error : '<' E:\GetStart\Cllectdlg\CStream.cpp(61) : error C2065: 'AddTail' : undeclared identifier Error executing cl.exe. Cllectdlg.exe - 4 error(s), 0 warning(s)
bhogavalli suresh wrote:
e:\getstart\cllectdlg\cstream.h(27) : error C2504: 'CList' : base class undefined
Notice the header requirements here.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne