Method One:
Modify the name of the class you define, VS2013 can use ctrl+h to replace a particular word, ctrl+f is used to query the location of a word or there is no existence.
Method Two:
1. Add a namespace to the whole of the. h and. cpp files for the class you define.
Edge.h file
Namespace Caishaohang {
Class Edge:public Node {
Public
virtual BOOL init ();
Create_func (Edge);
};
}
Edge.cpp file
Namespace caishaohang{
BOOL Edge::init () {
Node::init ();
Size visiblesize = director::getinstance ()->getvisiblesize ();
Setcontentsize (visiblesize);
Setphysicsbody (Physicsbody::createedgebox (visiblesize));
Getphysicsbody ()->setdynamic (false);
Getphysicsbody ()->getshape (0)->setfriction (0);
Getphysicsbody ()->getshape (0)->setrestitution (0);
return true;
}
}
2. When using a namespace, specify a class that uses our own definition
Auto _edge = Caishaohang::edge::create ();
Layer->addchild (_edge);
_edge->setposition (0, Positiony);
About the name of the class that you define in Cocos2d-x and the name of the class in the Cocos2d-x engine library. Duplicate resolution method