C++奇怪问题:在class中找不到函数成员
C++ strange problem: cannot find function member in class
这个问题看似很简单,但怎么都解决不了...
我在 class 中有原型,没有同名或函数的重复原型。却找不到。
看看这些截图就明白我的意思了
这是 class 在 header 文件中添加它们的位置
这是我尝试使用弹出的所有函数和变量都没有的地方。
正如您在该图像中看到的那样,RemoveParticle
函数与 FindTargetEffect
函数位于同一区域,但它可以很好地找到 RemoveParticle
,并且 FindTargetEffect
不能。
如果你认为这是定义..我把它们注释掉了,但它仍然不起作用
这里是headerclass.
class CParticleEntityManager {
public:
friend class CParticleEntity;
friend class CParticleBundle;
CParticleEntityManager();
int AddParticleToTargetBone(const char *name,
DWORD targetID,
int effectBoneIndex,
bool useEffectBoneRotation,
D3DXVECTOR3 &offset,
bool autoRemove = true,
/*bool bNonstopPlay = false,*/
bool continued = false,
D3DXMATRIX matContinued = D3DXMATRIX(0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f)/*
#ifdef DEF_XMODEL_BONE_EFFECT_OEN_081125
, bool bXModel = false
#endif
#ifdef DEF_ADD_PARTICLE_OEN_081211
, float fDelayTime = -1
#endif
#ifdef DEF_BUG_PARTICLE_OEN_090310
, int nTargetType = 0
, bool bOverlap = true
#endif*/
);
// Ä«¸Þ¶ó Áß¾Ó¿¡ ÆÄƼŬ °³Ã¼ »ý¼º, Çڵ鰪 ¸®ÅÏ
int AddParticleToCameraCenter(const char *name, bool autoRemove = true);
// ÁöÁ¤ÇÑ À§Ä¡¿Í ¹æÇâ¿¡ ÆÄƼŬ °³Ã¼ »ý¼º, Çڵ鰪 ¸®ÅÏ
int AddParticle(const char *name, D3DXVECTOR3 &position, D3DXMATRIX &rotation, bool autoRemove = true);
// ÁöÁ¤ÇÑ À§Ä¡¿¡ ÆÄƼŬ °³Ã¼ »ý¼º, Çڵ鰪 ¸®ÅÏ
int AddParticle(const char *name, D3DXVECTOR3 &position, bool autoRemove = true);
// ÆÄƼŬ °³Ã¼¸¦ À̵¿
void MoveParticle(int hEntity, D3DXVECTOR3 &position);
// ÆÄƼŬ °³Ã¼¸¦ À̵¿°ú ȸÀü
void MoveParticle(int hEntity, D3DXVECTOR3 &position, D3DXMATRIX &rotation);
// ÆÄƼŬ °³Ã¼ »èÁ¦ (immediately °¡ true ¸é ¹Ù·Î »èÁ¦, false ¸é ÇöÀç»ý¼ºµÈ ÆÄƼŬÀÇ ¼ö¸íÀÌ ´ÙÇÒ¶§±îÁö ±â´Ù¸²)
void RemoveParticle(int hEntity, bool immediately);
/**
* ÆÄƼŬ °³Ã¼ ¸®¼Â
* \date 2008-04-23
* \author oen
* \param hEntity ¸®¼Â ¿£Æ¼Æ¼ ÇÚµé
* \param *replace ÆÄƼŬÀ» º¯°æÇÑ´Ù¸é º¯°æÇÒ ÆÄƼŬ ¸í
* \param restart_ ¸®¼Â ÈÄ ÆÄƼŬÀ» ´Ù½Ã Ç÷¹ÀÌ ½ÃųÁö À¯¹«
*/
void ResetParticle(int hEntity, const char *replace = NULL, bool restart_ = true);
/**
* ÇØ´ç ÇÚµéÀ» °¡Áø °³Ã¼ÀÇ ºñÀúºíÀ» ¼³Á¤
* \date 2008-04-23
* \author oen
* \param hEntity ÇÚµé
* \param visible_ true : º¸ÀÓ false : ¾Èº¸ÀÓ
*/
//void SetVisible(int hEntity, bool visible_);
// ¸ðµç ÆÄƼŬ °³Ã¼ ¸®¼Â (¿¡µðÅÍ¿¡¼ »ç¿ë)
void ResetAllParticles();
// CMyD3DApplication::RenderView ¿¡¼ È£Ãâ (postRender ´Â ³ªÁß¿¡ µû·Î ·»´õ¸µÃ³¸®°¡ ÇÊ¿äÇÑ °æ¿ì¶§¹®¿¡ (¿¹¸¦ µé¸é ¹è°æȸéÀ» ¿Ö°îÇÏ´Â È¿°ú)
HRESULT Render(bool postRender);
// CMyD3DApplication::FrameMove ¿¡¼ È£Ãâ
void FrameMove(float elapsedTime);
// ±ÍÂúÀº DX °´Ã¼ º¹±¸ °ü¸® ÇÔ¼öµé :-(
HRESULT InitDeviceObjects(IDirect3DDevice9 *pDevice);
HRESULT RestoreDeviceObjects();
HRESULT InvalidateDeviceObjects();
HRESULT DeleteDeviceObjects();
#ifdef _TOOL
// ÀÌÆåÅ͵éÀ» Á¤¸®ÇÑ´Ù.
void Clear();
#endif
#if defined(DEF_BUG_PARTICLE_OEN_090310) || defined(DEF_EFFECT_OEN_090325)
/**
* µ¿ÀÏÇÑ ID ¿¡ µ¿ÀÏÇÑ ÀÌÆåÅÍ°¡ ºÙ¾î ÀÖ´ÂÁö »ìÇÉ´Ù.
* \param dwID ãÀ» ID
* \param strEffectName ãÀ» ÀÌÆåÅÍ ¸í
* \return ã¾Ò´Ù¸é ÇØ´ç ÀÌÆåÅ͸¦ ¸øã¾Ò´Ù¸é -1
*/
int FindTargetEffect(DWORD dwTargetID, LPCSTR strEffectName);
#endif
// ¿¡µðÅÍ¿¡¼ »ç¿ëÇÏ´Â º¯¼öµé
int m_hTestParticle;
D3DXVECTOR3 m_testParticleOffset;
bool m_showWireFrame;
bool m_freeze;
bool m_fixPosition;
int m_numDrawParticles;
bool m_bTabSelect; // ù¹ø° ÅÇÀÌ ¼±Åà µÇ¾ú´ÂÁö È®ÀÎ Çϱâ À§ÇÑ º¯¼ö
#ifdef DEF_EFFECT_BOX_ESCAFLOWNE_2006_03_16 // ÀÌÆåÆ®Åø ¿¡¹ÌÅÍ
BOXVERTEX m_Vertices[ 8 ];
BOXINDEX m_Indices[ 12 ];
LPDIRECT3DVERTEXBUFFER9 m_pBoxVB;
LPDIRECT3DINDEXBUFFER9 m_pBoxIB;
int m_nTest;
#endif
// ÆÄƼŬ °´Ã¼ Á¢±ÙÀ» À§ÇØ Á¢±Ù¿µ¿ª º¯°æ
CParticleEntity * GetEntityByHandle(int handle);
private:
void Init();
int GetNewHandle();
int GetSortedDrawEntities(CParticleEntity **drawEntities);
void FlushVertexBuffer(prtShaderStage_t *shader, int vbWriteOffset, int vbWriteSize);
#ifdef DEF_EFFECT_BOX_ESCAFLOWNE_2006_03_16 // ÀÌÆåÆ®Åø ¿¡¹ÌÅÍ
void InitBox(); // ¹Ú½º ÃʱâÈ
void RenderBox(); // ¹Ú½º ±×¸®±â
#endif
CParticleEntity * m_pEntities[MAX_PARTICLE_ENTITIES];
CParticleEntity * m_pEntityList;
int m_numEntities;
float m_fElapsedTime;
bool m_bConfirmDevice;
bool m_bRestoreDevice;
bool m_bSoftware;
PDIRECT3DDEVICE9 m_pD3DDev;
PDIRECT3DVERTEXBUFFER9 m_pVertexBuffer;
PDIRECT3DINDEXBUFFER9 m_pIndexBuffer;
PDIRECT3DVERTEXSHADER9 m_pBumpEnvVertexShader;
PDIRECT3DPIXELSHADER9 m_pBumpEnvPixelShader;
PDIRECT3DVERTEXSHADER9 m_pHeatHazeMaskVertexShader;
PDIRECT3DPIXELSHADER9 m_pHeatHazeMaskPixelShader;
CTexture * m_pHeatHazeTexture;
};
extern CParticleEntityManager g_particleEntityManager;
问题已解决。我在子文件夹中有完全相同的 header 文件。
effect\Effect_Sprite
我也把它放在项目的根目录中。
并且项目的根 header 已过时。
这个问题看似很简单,但怎么都解决不了...
我在 class 中有原型,没有同名或函数的重复原型。却找不到。
看看这些截图就明白我的意思了
这是 class 在 header 文件中添加它们的位置
这是我尝试使用弹出的所有函数和变量都没有的地方。
正如您在该图像中看到的那样,RemoveParticle
函数与 FindTargetEffect
函数位于同一区域,但它可以很好地找到 RemoveParticle
,并且 FindTargetEffect
不能。
如果你认为这是定义..我把它们注释掉了,但它仍然不起作用
这里是headerclass.
class CParticleEntityManager {
public:
friend class CParticleEntity;
friend class CParticleBundle;
CParticleEntityManager();
int AddParticleToTargetBone(const char *name,
DWORD targetID,
int effectBoneIndex,
bool useEffectBoneRotation,
D3DXVECTOR3 &offset,
bool autoRemove = true,
/*bool bNonstopPlay = false,*/
bool continued = false,
D3DXMATRIX matContinued = D3DXMATRIX(0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f)/*
#ifdef DEF_XMODEL_BONE_EFFECT_OEN_081125
, bool bXModel = false
#endif
#ifdef DEF_ADD_PARTICLE_OEN_081211
, float fDelayTime = -1
#endif
#ifdef DEF_BUG_PARTICLE_OEN_090310
, int nTargetType = 0
, bool bOverlap = true
#endif*/
);
// Ä«¸Þ¶ó Áß¾Ó¿¡ ÆÄƼŬ °³Ã¼ »ý¼º, Çڵ鰪 ¸®ÅÏ
int AddParticleToCameraCenter(const char *name, bool autoRemove = true);
// ÁöÁ¤ÇÑ À§Ä¡¿Í ¹æÇâ¿¡ ÆÄƼŬ °³Ã¼ »ý¼º, Çڵ鰪 ¸®ÅÏ
int AddParticle(const char *name, D3DXVECTOR3 &position, D3DXMATRIX &rotation, bool autoRemove = true);
// ÁöÁ¤ÇÑ À§Ä¡¿¡ ÆÄƼŬ °³Ã¼ »ý¼º, Çڵ鰪 ¸®ÅÏ
int AddParticle(const char *name, D3DXVECTOR3 &position, bool autoRemove = true);
// ÆÄƼŬ °³Ã¼¸¦ À̵¿
void MoveParticle(int hEntity, D3DXVECTOR3 &position);
// ÆÄƼŬ °³Ã¼¸¦ À̵¿°ú ȸÀü
void MoveParticle(int hEntity, D3DXVECTOR3 &position, D3DXMATRIX &rotation);
// ÆÄƼŬ °³Ã¼ »èÁ¦ (immediately °¡ true ¸é ¹Ù·Î »èÁ¦, false ¸é ÇöÀç»ý¼ºµÈ ÆÄƼŬÀÇ ¼ö¸íÀÌ ´ÙÇÒ¶§±îÁö ±â´Ù¸²)
void RemoveParticle(int hEntity, bool immediately);
/**
* ÆÄƼŬ °³Ã¼ ¸®¼Â
* \date 2008-04-23
* \author oen
* \param hEntity ¸®¼Â ¿£Æ¼Æ¼ ÇÚµé
* \param *replace ÆÄƼŬÀ» º¯°æÇÑ´Ù¸é º¯°æÇÒ ÆÄƼŬ ¸í
* \param restart_ ¸®¼Â ÈÄ ÆÄƼŬÀ» ´Ù½Ã Ç÷¹ÀÌ ½ÃųÁö À¯¹«
*/
void ResetParticle(int hEntity, const char *replace = NULL, bool restart_ = true);
/**
* ÇØ´ç ÇÚµéÀ» °¡Áø °³Ã¼ÀÇ ºñÀúºíÀ» ¼³Á¤
* \date 2008-04-23
* \author oen
* \param hEntity ÇÚµé
* \param visible_ true : º¸ÀÓ false : ¾Èº¸ÀÓ
*/
//void SetVisible(int hEntity, bool visible_);
// ¸ðµç ÆÄƼŬ °³Ã¼ ¸®¼Â (¿¡µðÅÍ¿¡¼ »ç¿ë)
void ResetAllParticles();
// CMyD3DApplication::RenderView ¿¡¼ È£Ãâ (postRender ´Â ³ªÁß¿¡ µû·Î ·»´õ¸µÃ³¸®°¡ ÇÊ¿äÇÑ °æ¿ì¶§¹®¿¡ (¿¹¸¦ µé¸é ¹è°æȸéÀ» ¿Ö°îÇÏ´Â È¿°ú)
HRESULT Render(bool postRender);
// CMyD3DApplication::FrameMove ¿¡¼ È£Ãâ
void FrameMove(float elapsedTime);
// ±ÍÂúÀº DX °´Ã¼ º¹±¸ °ü¸® ÇÔ¼öµé :-(
HRESULT InitDeviceObjects(IDirect3DDevice9 *pDevice);
HRESULT RestoreDeviceObjects();
HRESULT InvalidateDeviceObjects();
HRESULT DeleteDeviceObjects();
#ifdef _TOOL
// ÀÌÆåÅ͵éÀ» Á¤¸®ÇÑ´Ù.
void Clear();
#endif
#if defined(DEF_BUG_PARTICLE_OEN_090310) || defined(DEF_EFFECT_OEN_090325)
/**
* µ¿ÀÏÇÑ ID ¿¡ µ¿ÀÏÇÑ ÀÌÆåÅÍ°¡ ºÙ¾î ÀÖ´ÂÁö »ìÇÉ´Ù.
* \param dwID ãÀ» ID
* \param strEffectName ãÀ» ÀÌÆåÅÍ ¸í
* \return ã¾Ò´Ù¸é ÇØ´ç ÀÌÆåÅ͸¦ ¸øã¾Ò´Ù¸é -1
*/
int FindTargetEffect(DWORD dwTargetID, LPCSTR strEffectName);
#endif
// ¿¡µðÅÍ¿¡¼ »ç¿ëÇÏ´Â º¯¼öµé
int m_hTestParticle;
D3DXVECTOR3 m_testParticleOffset;
bool m_showWireFrame;
bool m_freeze;
bool m_fixPosition;
int m_numDrawParticles;
bool m_bTabSelect; // ù¹ø° ÅÇÀÌ ¼±Åà µÇ¾ú´ÂÁö È®ÀÎ Çϱâ À§ÇÑ º¯¼ö
#ifdef DEF_EFFECT_BOX_ESCAFLOWNE_2006_03_16 // ÀÌÆåÆ®Åø ¿¡¹ÌÅÍ
BOXVERTEX m_Vertices[ 8 ];
BOXINDEX m_Indices[ 12 ];
LPDIRECT3DVERTEXBUFFER9 m_pBoxVB;
LPDIRECT3DINDEXBUFFER9 m_pBoxIB;
int m_nTest;
#endif
// ÆÄƼŬ °´Ã¼ Á¢±ÙÀ» À§ÇØ Á¢±Ù¿µ¿ª º¯°æ
CParticleEntity * GetEntityByHandle(int handle);
private:
void Init();
int GetNewHandle();
int GetSortedDrawEntities(CParticleEntity **drawEntities);
void FlushVertexBuffer(prtShaderStage_t *shader, int vbWriteOffset, int vbWriteSize);
#ifdef DEF_EFFECT_BOX_ESCAFLOWNE_2006_03_16 // ÀÌÆåÆ®Åø ¿¡¹ÌÅÍ
void InitBox(); // ¹Ú½º ÃʱâÈ
void RenderBox(); // ¹Ú½º ±×¸®±â
#endif
CParticleEntity * m_pEntities[MAX_PARTICLE_ENTITIES];
CParticleEntity * m_pEntityList;
int m_numEntities;
float m_fElapsedTime;
bool m_bConfirmDevice;
bool m_bRestoreDevice;
bool m_bSoftware;
PDIRECT3DDEVICE9 m_pD3DDev;
PDIRECT3DVERTEXBUFFER9 m_pVertexBuffer;
PDIRECT3DINDEXBUFFER9 m_pIndexBuffer;
PDIRECT3DVERTEXSHADER9 m_pBumpEnvVertexShader;
PDIRECT3DPIXELSHADER9 m_pBumpEnvPixelShader;
PDIRECT3DVERTEXSHADER9 m_pHeatHazeMaskVertexShader;
PDIRECT3DPIXELSHADER9 m_pHeatHazeMaskPixelShader;
CTexture * m_pHeatHazeTexture;
};
extern CParticleEntityManager g_particleEntityManager;
问题已解决。我在子文件夹中有完全相同的 header 文件。
effect\Effect_Sprite
我也把它放在项目的根目录中。
并且项目的根 header 已过时。