c++ - forward declaration of 'const class LHContactInfo' error when try to access it property -


i have 2 c++ class bellow. want lhcontactinfo property lhscenesubclass can nothing.so how can this?

#ifndef __levelhelper_api_contact_info_h__  #define __levelhelper_api_contact_info_h__    #include "lhconfig.h"  #if lh_use_box2d    #include "cocos2d.h"    class b2contact;    using namespace cocos2d;    class lhcontactinfo  {  public:            lhcontactinfo();      virtual ~lhcontactinfo();            node*       nodea;      node*       nodeb;      std::string nodeashapename;      std::string nodebshapename;      int         nodeashapeid;      int         nodebshapeid;            point       contactpoint;      float       impulse;            b2contact*  box2dcontact;  };    #endif    #endif //__levelhelper_api_contact_info_h__      #include "lhcontactinfo.h"    #if lh_use_box2d    #include "box2d/box2d.h"    lhcontactinfo::lhcontactinfo(){      nodea = null;      nodeb = null;      box2dcontact = null;  }  lhcontactinfo::~lhcontactinfo(){      nodea = null;      nodeb = null;      box2dcontact = null;  }    #endif

#ifndef __lh_scene_subclass_h__  #define __lh_scene_subclass_h__    #include "cocos2d.h"  #include "levelhelper2api.h"    class lhcontactinfo;  class lhscenesubclass : public lhscene  {  public:      static cocos2d::scene* createscene();        lhscenesubclass();      virtual ~lhscenesubclass();            bool initwithcontentoffile(const std::string& plistlevelfile);      virtual bool shoulddisablecontactbetweennodes(node* nodea, node* nodeb);      virtual void didbegincontact(const lhcontactinfo& contact);      virtual void didendcontact(const lhcontactinfo& contact);  };    #endif // __lh_scene_subclass_h__      //file.cpp    void lhscenesubclass::didbegincontact(const lhcontactinfo& contact){  	if(contact.nodea->getname() == "box1"){// error invalid use of incomplete type 'const class    lhcontactinfo'    	}  }  void lhscenesubclass::didendcontact(const lhcontactinfo& contact){      cclog("didendcontact...\n");  }

i want contact.nodea lhcontactinfo in didbegincontact function compile error ->error invalid use of incomplete type 'const class lhcontactinfo'

note:: - compile android ndk 10c

the class lhcontactinfo declared (ie, know name), due forward declaration. however, compiler needs class definition. need include file containing class definition.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -