Error: must be initialized in constructor base/member initializer list

I did this code:

.h file:

1
2
3
4
5
6
7
8
9
10
11
12
private:

hkpRigidBodyCinfo&		m_bodyInfo;
hkpCharacterRigidBodyCinfo& m_characterBodyInfo;

public:

OgreHavokBody(hkpRigidBodyCinfo& bodyInfo);
OgreHavokBody(hkpCharacterRigidBodyCinfo& characterBodyInfo);
OgreHavokBody(hkpRigidBodyCinfo& bodyInfo, int vertex_count, Ogre::Vector3* vertices, int index_count, int *indices);
OgreHavokBody(hkpCharacterRigidBodyCinfo& characterBodyInfo, int vertex_count, Ogre::Vector3* vertices, int index_count, int *indices);


and .ccp file:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
OgreHavokBody::OgreHavokBody(hkpRigidBodyCinfo& bodyInfo) : m_bodyInfo(bodyInfo)
{
	m_pNode = 0;
	m_pDebugNode = 0;
	m_position = Ogre::Vector3::ZERO;
	m_orientation = Ogre::Quaternion::IDENTITY;

	// Create the rigid body
	m_pRigidBody = new hkpRigidBody(m_bodyInfo);
	createDebug();
}

OgreHavokBody::OgreHavokBody(hkpCharacterRigidBodyCinfo& characterBodyInfo) : m_characterBodyInfo(characterBodyInfo)
{
	m_pNode = 0;
	m_pDebugNode = 0;
	m_position = Ogre::Vector3::ZERO;
	m_orientation = Ogre::Quaternion::IDENTITY;

	// Create the rigid body
	m_characterRigidBody = new hkpCharacterRigidBody( m_characterBodyInfo );
	m_pRigidBody = m_characterRigidBody->getRigidBody();
	createDebug();
}

OgreHavokBody::OgreHavokBody(hkpRigidBodyCinfo& bodyInfo, int vertex_count, Ogre::Vector3* vertices, int index_count, int *indices) : m_bodyInfo(bodyInfo)
{	
	m_pNode = 0;
	m_pDebugNode = 0;
	m_position = Ogre::Vector3::ZERO;
	m_orientation = Ogre::Quaternion::IDENTITY;

	hkpMoppBvTreeShape* pTreeShape = createShape(vertex_count,vertices,index_count,indices);
	
	m_bodyInfo.m_shape = pTreeShape;
	m_pRigidBody = new hkpRigidBody(m_bodyInfo);	
	pTreeShape->removeReference();
	createDebug();
}

OgreHavokBody::OgreHavokBody(hkpCharacterRigidBodyCinfo& characterBodyInfo, int vertex_count, Ogre::Vector3* vertices, int index_count, int *indices) : m_characterBodyInfo(characterBodyInfo)
{	
	m_pNode = 0;
	m_pDebugNode = 0;
	m_position = Ogre::Vector3::ZERO;
	m_orientation = Ogre::Quaternion::IDENTITY;

	hkpMoppBvTreeShape* pTreeShape = createShape(vertex_count,vertices,index_count,indices);

	m_characterBodyInfo.m_shape = pTreeShape;
	m_characterRigidBody = new hkpCharacterRigidBody( m_characterBodyInfo );
	m_pRigidBody = m_characterRigidBody->getRigidBody();
	pTreeShape->removeReference();
	createDebug();
}


I'm initializing m_bodyInfo but it still gives me this error:

Compiling...
OgreHavokBody.cpp
c:\ogrenew\dark future\ogrehavokbody.cpp(4) : error C2758: 'OgreHavokBody::m_characterBodyInfo' : must be initialized in constructor base/member initializer list
c:\ogrenew\dark future\ogrehavokbody.h(24) : see declaration of 'OgreHavokBody::m_characterBodyInfo'
c:\ogrenew\dark future\ogrehavokbody.cpp(16) : error C2758: 'OgreHavokBody::m_bodyInfo' : must be initialized in constructor base/member initializer list
c:\ogrenew\dark future\ogrehavokbody.h(23) : see declaration of 'OgreHavokBody::m_bodyInfo'
c:\ogrenew\dark future\ogrehavokbody.cpp(29) : error C2758: 'OgreHavokBody::m_characterBodyInfo' : must be initialized in constructor base/member initializer list
c:\ogrenew\dark future\ogrehavokbody.h(24) : see declaration of 'OgreHavokBody::m_characterBodyInfo'
c:\ogrenew\dark future\ogrehavokbody.cpp(44) : error C2758: 'OgreHavokBody::m_bodyInfo' : must be initialized in constructor base/member initializer list
c:\ogrenew\dark future\ogrehavokbody.h(23) : see declaration of 'OgreHavokBody::m_bodyInfo'
Generating Code...

What I'm missing?
Last edited on
Topic archived. No new replies allowed.