pointer on class
-
MFC, STUDIO 2008, MDI-project If to comment СAdderDialog* m_pModeless5; then OK! // modeldlg.h : implementation file protected: СAdderDialog* m_pModeless5; // pointer on class error C2143: syntax error : missing ';' before '*' error C4430: missing type specifier - int assumed. Note: C++ does not support default-int error C4430: missing type specifier - int assumed. Note: C++ does not support default-int : error C2614: 'CMainDlg' : illegal member initialization: 'm_pModeless5' is not a base or member class CAdderDialog : public Cdialog class CMainDlg : public Cdialog // adderdlg.cpp : implementation file #include "stdafx.h" #include "ADO_MDI.h" #include "Aadderdlg.h" #include "modeldlg.h" // modeldlg.cpp : implementation file #include "stdafx.h" #include "ADO_MDI.h" #include "Aadderdlg.h" #include "modeldlg.h"
-
MFC, STUDIO 2008, MDI-project If to comment СAdderDialog* m_pModeless5; then OK! // modeldlg.h : implementation file protected: СAdderDialog* m_pModeless5; // pointer on class error C2143: syntax error : missing ';' before '*' error C4430: missing type specifier - int assumed. Note: C++ does not support default-int error C4430: missing type specifier - int assumed. Note: C++ does not support default-int : error C2614: 'CMainDlg' : illegal member initialization: 'm_pModeless5' is not a base or member class CAdderDialog : public Cdialog class CMainDlg : public Cdialog // adderdlg.cpp : implementation file #include "stdafx.h" #include "ADO_MDI.h" #include "Aadderdlg.h" #include "modeldlg.h" // modeldlg.cpp : implementation file #include "stdafx.h" #include "ADO_MDI.h" #include "Aadderdlg.h" #include "modeldlg.h"
CHIVOTIOV wrote:
#include "Aadderdlg.h"
Any typo there?
«_Superman_» I love work. It gives me something to do between weekends.
-
MFC, STUDIO 2008, MDI-project If to comment СAdderDialog* m_pModeless5; then OK! // modeldlg.h : implementation file protected: СAdderDialog* m_pModeless5; // pointer on class error C2143: syntax error : missing ';' before '*' error C4430: missing type specifier - int assumed. Note: C++ does not support default-int error C4430: missing type specifier - int assumed. Note: C++ does not support default-int : error C2614: 'CMainDlg' : illegal member initialization: 'm_pModeless5' is not a base or member class CAdderDialog : public Cdialog class CMainDlg : public Cdialog // adderdlg.cpp : implementation file #include "stdafx.h" #include "ADO_MDI.h" #include "Aadderdlg.h" #include "modeldlg.h" // modeldlg.cpp : implementation file #include "stdafx.h" #include "ADO_MDI.h" #include "Aadderdlg.h" #include "modeldlg.h"
Forward declare class СAdderDialog before class declaration;
class СAdderDialog;
Regards, Paresh. -
MFC, STUDIO 2008, MDI-project If to comment СAdderDialog* m_pModeless5; then OK! // modeldlg.h : implementation file protected: СAdderDialog* m_pModeless5; // pointer on class error C2143: syntax error : missing ';' before '*' error C4430: missing type specifier - int assumed. Note: C++ does not support default-int error C4430: missing type specifier - int assumed. Note: C++ does not support default-int : error C2614: 'CMainDlg' : illegal member initialization: 'm_pModeless5' is not a base or member class CAdderDialog : public Cdialog class CMainDlg : public Cdialog // adderdlg.cpp : implementation file #include "stdafx.h" #include "ADO_MDI.h" #include "Aadderdlg.h" #include "modeldlg.h" // modeldlg.cpp : implementation file #include "stdafx.h" #include "ADO_MDI.h" #include "Aadderdlg.h" #include "modeldlg.h"
-
MFC, STUDIO 2008, MDI-project If to comment СAdderDialog* m_pModeless5; then OK! // modeldlg.h : implementation file protected: СAdderDialog* m_pModeless5; // pointer on class error C2143: syntax error : missing ';' before '*' error C4430: missing type specifier - int assumed. Note: C++ does not support default-int error C4430: missing type specifier - int assumed. Note: C++ does not support default-int : error C2614: 'CMainDlg' : illegal member initialization: 'm_pModeless5' is not a base or member class CAdderDialog : public Cdialog class CMainDlg : public Cdialog // adderdlg.cpp : implementation file #include "stdafx.h" #include "ADO_MDI.h" #include "Aadderdlg.h" #include "modeldlg.h" // modeldlg.cpp : implementation file #include "stdafx.h" #include "ADO_MDI.h" #include "Aadderdlg.h" #include "modeldlg.h"
classic case of non-usuage of forward decalaration
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
Never mind - my own stupidity is the source of every "problem" - Mixturecheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You
-
Typo: #include "Aadderdlg.h" //"a" too much X| for class #include СAdderDialog
Press F1 for help or google it. Greetings from Germany
advanced to forward, 2 errors became less: #pragma once class СAdderDialog; // after addition this line into file "modeldlg.h" eliminate (remove)only 2 errors // CMainDlg class CMainDlg : public CDialog { СAdderDialog* m_pModeless5; CMainDlg::CMainDlg(CWnd* pParent /*=NULL*/) : CDialog(CMainDlg::IDD, pParent) , m_pModeless5(NULL) { . . . . . . . . . . . /////////////////////////////////////// void CMainDlg::OnOK() { if (m_pModeless5 == NULL) // OK! { m_pModeless5 = new CAdderDialog(this); // error C2440: '=' : cannot convert from 'CAdderDialog *' to 'СAdderDialog *' if (m_pModeless5->Create() == TRUE) // modeldlg.cpp(67) : error C2027: use of undefined type 'СAdderDialog' // error C2227: left of '->Create' must point to class/struct/union/generic type GetDlgItem(IDOK)->EnableWindow(FALSE); } else m_pModeless5->SetActiveWindow(); // error C2027: use of undefined type 'СAdderDialog' }
-
advanced to forward, 2 errors became less: #pragma once class СAdderDialog; // after addition this line into file "modeldlg.h" eliminate (remove)only 2 errors // CMainDlg class CMainDlg : public CDialog { СAdderDialog* m_pModeless5; CMainDlg::CMainDlg(CWnd* pParent /*=NULL*/) : CDialog(CMainDlg::IDD, pParent) , m_pModeless5(NULL) { . . . . . . . . . . . /////////////////////////////////////// void CMainDlg::OnOK() { if (m_pModeless5 == NULL) // OK! { m_pModeless5 = new CAdderDialog(this); // error C2440: '=' : cannot convert from 'CAdderDialog *' to 'СAdderDialog *' if (m_pModeless5->Create() == TRUE) // modeldlg.cpp(67) : error C2027: use of undefined type 'СAdderDialog' // error C2227: left of '->Create' must point to class/struct/union/generic type GetDlgItem(IDOK)->EnableWindow(FALSE); } else m_pModeless5->SetActiveWindow(); // error C2027: use of undefined type 'СAdderDialog' }