Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
216 views
in Technique[技术] by (71.8m points)

C++ strange problem: cannot find function member in class

This problem seems very simple but I cannot solve it no matter what I try...
I have the prototype in the class, there is no duplicate prototypes with the same name nor functions. Yet it can't find it.

Look at these screenshots to see what I mean

1

Here is the class where they are added in the header file enter image description here

Here is where I try to use the thing where all the functions and variables pop out doesn't have it.

enter image description here

As you can see in that image the RemoveParticle function is in the same area as FindTargetEffect function yet it can find the RemoveParticle just fine, and FindTargetEffect it can't.

If you think it's the defines.. i commented them out and it still doesn't work enter image description here

Here is the header class.

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*/
                                                    );

    // ???T?ó á??ó?? ?????? °3?? ?y?o, ?úμé°a ????
    int                     AddParticleToCameraCenter(const char *name, bool autoRemove = true);

    // á?á¤?? à§???í 1??a?? ?????? °3?? ?y?o, ?úμé°a ????
    int                     AddParticle(const char *name, D3DXVECTOR3 &position, D3DXMATRIX &rotation, bool autoRemove = true);

    // á?á¤?? à§???? ?????? °3?? ?y?o, ?úμé°a ????
    int                     AddParticle(const char *name, D3DXVECTOR3 &position, bool autoRemove = true);

    // ?????? °3???| àìμ?
    void                    MoveParticle(int hEntity, D3DXVECTOR3 &position);

    // ?????? °3???| àìμ?°ú è?àü
    void                    MoveParticle(int hEntity, D3DXVECTOR3 &position, D3DXMATRIX &rotation);

    // ?????? °3?? ?èá| (immediately °? true ?é 1ù·? ?èá|, false ?é ??à??y?oμè ??????à? ???íàì ′ù?ò?§±?á? ±a′ù?2)
    void                    RemoveParticle(int hEntity, bool immediately);

    /**
     *  ?????? °3?? ????
     * date 2008-04-23
     * author oen
     * param hEntity ???? ?£???? ?úμé
     * param *replace ??????à? oˉ°???′ù?é oˉ°??ò ?????? ?í
     * param restart_ ???? è? ??????à? ′ù?? ??·1àì ???3á? àˉ1?
     */
    void                    ResetParticle(int hEntity, const char *replace = NULL, bool restart_ = true);

    /**
     *  ??′? ?úμéà? °?á? °3??à? o?àúoíà? ?3á¤
     * date 2008-04-23
     * author oen
     * param hEntity ?úμé
     * param visible_ true : o?àó false : ?èo?àó
     */
    //void                    SetVisible(int hEntity, bool visible_);

    // ?eμ? ?????? °3?? ???? (??μe?í???- ????)
    void                    ResetAllParticles();       

    // CMyD3DApplication::RenderView ???- è£?a (postRender ′? 3aá??? μ?·? ·?′??μ?3??°? ?ê???? °??ì?§1??? (?1?| μé?é 1è°?è-?éà? ??°???′? è?°ú)
    HRESULT                 Render(bool postRender);

    // CMyD3DApplication::FrameMove ???- �a
    void                    FrameMove(float elapsedTime);

    // ±í?úào DX °′?? o1±? °ü?? ????μé :-(
    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 ?? μ?à??? àì???í°? où?? à?′?á? ?ì?é′ù.
     * param dwID ?£à? ID
     * param strEffectName ?£à? àì???í ?í
     * 
eturn ?£?ò′ù?é ??′? àì???í?| ???£?ò′ù?é -1
     */
    int                    FindTargetEffect(DWORD dwTargetID, LPCSTR strEffectName);
#endif

    // ??μe?í???- ??????′? oˉ??μé
    int                     m_hTestParticle;
    D3DXVECTOR3             m_testParticleOffset;
    bool                    m_showWireFrame;
    bool                    m_freeze;
    bool                    m_fixPosition;
    int                     m_numDrawParticles;

    bool                    m_bTabSelect;               // ?11??° ??àì ?±?? μ??ú′?á? è?à? ??±a à§?? oˉ??

#ifdef DEF_EFFECT_BOX_ESCAFLOWNE_2006_03_16             // àì?????? ??1ì?í

    BOXVERTEX               m_Vertices[ 8 ];
    BOXINDEX                m_Indices[ 12 ];

    LPDIRECT3DVERTEXBUFFER9 m_pBoxVB;
    LPDIRECT3DINDEXBUFFER9  m_pBoxIB;

    int                     m_nTest;
#endif

    // ?????? °′?? ᢱùà? à§?? ᢱù?μ?a oˉ°?
    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             // àì?????? ??1ì?í
    void                    InitBox();                  // 1ú?o ?ê±aè-
    void                    RenderBox();                // 1ú?o ±×??±a
#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;
question from:https://stackoverflow.com/questions/65857457/c-strange-problem-cannot-find-function-member-in-class

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Problem solved.. I had the same exact header file in a subfolder.

effectEffect_Sprite

and I also had it in the root of the project.

and the root of the project headers were outdated.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...