Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Burty

Where does this error come from!!?? :-(

This topic is 5459 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to work on a MFC project. Was working fine till i added a new member function CPerson* AddNewRecord(); (its private) Then when i tryed to compile my project it wont work but checked books and thats how they say to do it can you please advise and tell me what i am missing? Compiling... StdAfx.cpp Compiling... FileForms.cpp c:\program files\microsoft visual studio\myprojects\fileforms\fileformsdoc.h(56) : error C2143: syntax error : missing '';'' before ''*'' c:\program files\microsoft visual studio\myprojects\fileforms\fileformsdoc.h(56) : error C2501: ''CPerson'' : missing storage-class or type specifiers c:\program files\microsoft visual studio\myprojects\fileforms\fileformsdoc.h(56) : error C2501: ''AddNewRecord'' : missing storage-class or type specifiers FileFormsDoc.cpp FileFormsView.cpp c:\program files\microsoft visual studio\myprojects\fileforms\fileformsdoc.h(56) : error C2143: syntax error : missing '';'' before ''*'' c:\program files\microsoft visual studio\myprojects\fileforms\fileformsdoc.h(56) : error C2501: ''CPerson'' : missing storage-class or type specifiers c:\program files\microsoft visual studio\myprojects\fileforms\fileformsdoc.h(56) : error C2501: ''AddNewRecord'' : missing storage-class or type specifiers MainFrm.cpp Person.cpp Generating Code... Error executing cl.exe. FileForms.exe - 6 error(s), 0 warning(s) Code below from FileFormsDoc.h protected: DECLARE_MESSAGE_MAP(); private: CObArray m_oaPeople; int m_iCurPosition; CPerson* AddNewRecord(); Code below from FileFormsDoc.cpp CPerson* CFileFormsDoc::AddNewRecord() { CPerson *pPerson = new CPerson(); try { m_oaPeople.Add(pPerson); SetModifiedFlag(); m_iCurPosition = (m_oaPeople.GetSize()-1); } catch (CMemoryException* perr) { if (pPerson) { delete pPerson; pPerson = NULL; } perr->Delete(); } return pPerson; } Thanks for you time and help.

Share this post


Link to post
Share on other sites
Advertisement
quote:
Original post by Burty

Code below from FileFormsDoc.h

protected:
DECLARE_MESSAGE_MAP();
private:
CObArray m_oaPeople;
int m_iCurPosition;
CPerson* AddNewRecord();




class CPerson
{
protected:
DECLARE_MESSAGE_MAP();
private:
CObArray m_oaPeople;
int m_iCurPosition;
CPerson* AddNewRecord();
};
?

Share this post


Link to post
Share on other sites
Looks like CPerson and AddNewRecord are unknown.
Have all the required includes?
Did not forget the ; at the end of your class?

class CPerson
{
...
};

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!