problem about the redefine
I wrote a class which is based on the CDialog,but the NET told me some redefine occurs
/**************************************
.h
**************************************/
//#pragma once
class MotionClip;
ClipToLetter dialog
class ClipToLetter : public CDialog
{
DECLARE_DYNAMIC(ClipToLetter)
public:
ClipToLetter(CWnd* pParent = NULL); // standard constructor
virtual ~ClipToLetter();
// Dialog Data
enum { IDD = IDD_DLG1 };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
DECLARE_MESSAGE_MAP()
public:
void AssignLetterToClip();
void GetInMotionClip(MotionClip* mc);
public:
MotionClip* _mc;
private:
bool m_stand;
bool m_walk;
bool m_jump;
bool m_squat;
bool m_dodge;
bool m_punch;
bool m_kick;
bool m_run;
};
/***************************************************
.cpp
***************************************************/
// ClipToLetter.cpp : implementation file
//
#include "stdafx.h"
#include "OpenGLFrame.h"
#include "ClipToLetter.h"
#include "MotionGraph/MotionClip.h"
// ClipToLetter dialog
IMPLEMENT_DYNAMIC(ClipToLetter, CDialog)
ClipToLetter::ClipToLetter(CWnd* pParent /*=NULL*/)
: CDialog(ClipToLetter::IDD, pParent)
, m_stand(false)
, m_walk(false)
, m_jump(false)
, m_squat(false)
, m_dodge(false)
, m_punch(false)
, m_kick(false)
, m_run(false)
{
}
ClipToLetter::~ClipToLetter()
{
}
void ClipToLetter::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(ClipToLetter, CDialog)
END_MESSAGE_MAP()
// ClipToLetter message handlers
// ClipToLetter.cpp : implementation file
//
#include "stdafx.h"
#include "OpenGLFrame.h"
#include "ClipToLetter.h"
// ClipToLetter dialog
IMPLEMENT_DYNAMIC(ClipToLetter, CDialog)
ClipToLetter::ClipToLetter(CWnd* pParent /*=NULL*/)
: CDialog(ClipToLetter::IDD, pParent)
{
}
ClipToLetter::~ClipToLetter()
{
}
void ClipToLetter::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(ClipToLetter, CDialog)
END_MESSAGE_MAP()
// ClipToLetter message handlers
void ClipToLetter::AssignLetterToClip(){
if (m_stand){
_mc->letter = 'S';
}
if (m_walk){
_mc->letter = 'W';
}
if (m_jump){
_mc->letter = 'J';
}
if (m_squat){
_mc->letter = 'Q';
}
if (m_dodge){
_mc->letter = 'D';
}
if (m_punch){
_mc->letter = 'P';
}
if (m_kick){
_mc->letter = 'K';
}
if (m_run){
_mc->letter = 'R';
}
}
void ClipToLetter::GetInMotionClip(MotionClip* mc){
this->_mc = mc;
}
/**************************************************************
ERROR
***************************************************************/
error C2084: function 'CRuntimeClass *ClipToLetter::_GetBaseClass(void)' already has a body
e:\simupentomime\openglframe\openglframe\cliptoletter.h(8) : see previous definition of '_GetBaseClass'
e:\simupentomime\openglframe\openglframe\cliptoletter.cpp(53) : error C2374: 'classClipToLetter' : redefinition; multiple initialization
e:\simupentomime\openglframe\openglframe\cliptoletter.h(8) : see declaration of 'classClipToLetter'
e:\simupentomime\openglframe\openglframe\cliptoletter.cpp(53) : error C2084: function 'CRuntimeClass *ClipToLetter::GetThisClass(void)' already has a body
e:\simupentomime\openglframe\openglframe\cliptoletter.h(8) : see previous definition of 'GetThisClass'
e:\simupentomime\openglframe\openglframe\cliptoletter.cpp(53) : error C2084: function 'CRuntimeClass *ClipToLetter::GetRuntimeClass(void) const' already has a body
e:\simupentomime\openglframe\openglframe\cliptoletter.h(8) : see previous definition of 'GetRuntimeClass'
e:\simupentomime\openglframe\openglframe\cliptoletter.cpp(56) : error C2084: function 'ClipToLetter::ClipToLetter(CWnd *)' already has a body
e:\simupentomime\openglframe\openglframe\cliptoletter.h(11) : see previous definition of '{ctor}'
e:\simupentomime\openglframe\openglframe\cliptoletter.cpp(62) : error C2084: function 'ClipToLetter::~ClipToLetter(void)' already has a body
e:\simupentomime\openglframe\openglframe\cliptoletter.h(12) : see previous definition of '{dtor}'
e:\simupentomime\openglframe\openglframe\cliptoletter.cpp(66) : error C2084: function 'void ClipToLetter::DoDataExchange(CDataExchange *)' already has a body
e:\simupentomime\openglframe\openglframe\cliptoletter.h(18) : see previous definition of 'DoDataExchange'
e:\simupentomime\openglframe\openglframe\cliptoletter.cpp(71) : error C2084: function 'const AFX_MSGMAP *ClipToLetter::GetMessageMap(void) const' already has a body
e:\simupentomime\openglframe\openglframe\cliptoletter.h(20) : see previous definition of 'GetMessageMap'
e:\simupentomime\openglframe\openglframe\cliptoletter.cpp(71) : error C2084: function 'const AFX_MSGMAP *ClipToLetter::GetThisMessageMap(void)' already has a body
e:\simupentomime\openglframe\openglframe\cliptoletter.h(20) : see previous definition of 'GetThisMessageMap'
I'm not sure about your whole project, but at first glance it looks like your header file simply gets included too often.
At the beginning you should have something like:
Try that, see if it works, and use code tags or something next time please.
Hope that helps :)
At the beginning you should have something like:
#ifndef MOTION_CLIP_H #define MOTION_CLIP_H rest of header as it was goes here... #endif
Try that, see if it works, and use code tags or something next time please.
Hope that helps :)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement