Blacktempel
Blacktempel

Reputation: 3995

Error C4430 - Object - Classes

I created a object of the class LCalculation in another class,

class LCalculation
{
    public:
        unsigned __int64 m_Amount_of_Numbers;
        [...]
};

now I'm trying to use it and face those errors. It has something to do with this object declaration. I just don't get it. Could anyone help with this ? If more information is needed, feel free to ask.



class CMFC_App_CalculationDlg : public CDialogEx
{
private:
    LCalculation m_LCalc;
};


void CMFC_App_Calculation::OnEnChangeEdit2()
{
    m_LCalc.m_Amount_of_Numbers = UpdateData(TRUE);
}






Get it, I'm new here. @Joachim Pileborg. Thanks.

First header:

// MFC_App_Calculation.h : main header file for the PROJECT_NAME application
//

#pragma once

#ifndef __AFXWIN_H__
    #error "include 'stdafx.h' before including this file for PCH"
#endif

#include "resource.h"       // main symbols


// CMFC_App_CalculationApp:
// See MFC_App_Calculation.cpp for the implementation of this class
//

class CMFC_App_CalculationApp : public CWinApp
{
public:
    CMFC_App_CalculationApp();

// Overrides
public:
    virtual BOOL InitInstance();

// Implementation

    DECLARE_MESSAGE_MAP()
};

extern CMFC_App_CalculationApp theApp;

Second header:

// MFC_App_CalculationDlg.h : header file
//

#pragma once


// CMFC_App_CalculationDlg dialog
class CMFC_App_CalculationDlg : public CDialogEx
{
// Construction
public:
    CMFC_App_CalculationDlg(CWnd* pParent = NULL);  // standard constructor

// Dialog Data
    enum { IDD = IDD_MFC_APP_CALCULATION_DIALOG };

    protected:
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support


// Implementation
protected:
    HICON m_hIcon;

    // Generated message map functions
    virtual BOOL OnInitDialog();
    afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
    afx_msg void OnPaint();
    afx_msg HCURSOR OnQueryDragIcon();
    DECLARE_MESSAGE_MAP()
public:
    afx_msg void OnBnClickedRadio1();
    afx_msg void OnBnClickedRadio2();
private:
    LCalculation m_LCalc;
public:
    afx_msg void OnEnChangeEdit2();
};

Third header:

#pragma once
/*Comments*/
class LCalculation
{
    public:
        unsigned __int64 m_Amount_of_Numbers;
        unsigned __int64 m_Amount_of_Guesses;
        unsigned __int64 m_Probability;
        LCalculation ();
        bool m_bEqual;
        void CalculateThis ();
        void SZ_true ();
        void SZ_false ();
        void NUMBERequals (unsigned __int64 NUMBERS, unsigned __int64 GUESSES, unsigned __int16 IDENTIFIER);
};

Upvotes: 0

Views: 1011

Answers (1)

Werner Henze
Werner Henze

Reputation: 16781

In your second header (MFC_App_CalculationDlg.h) you forgot to #include "LCalculation.h" or however you named the third header.

And BTW, UpdateData returns a BOOL, not an amount_of_numbers. You should read the documentation for UpdateData and DoDataExchange to better understand how MFC is doing data exchange from/to dialog controls.

Upvotes: 2

Related Questions