We are looking for some help, new to cocos2dx and having error.iam using the Eclipse IDE
inside HelloWorld.cpp iam:
_backgroundNode = CCParallaxNodeExtras::node();
and it gives me an undefined reference error that looks like this
undefined reference to 'CCParallaxNodeExtras :: node ()'
My CCParallaxNodeExtras.h header file code is as follows: it inherits CCParallaxNode
using namespace cocos2d; #include "cocos2d.h" class CCParallaxNodeExtras : public cocos2d::CCParallaxNode { public :
here is CCParallaxNodeExtras.cpp
#include "CCParallaxNodeExtras.h" using namespace cocos2d; // Hack to access CCPointObject (which is not a public class) class CCPointObject : cocos2d::CCObject { CC_SYNTHESIZE(cocos2d::CCPoint, m_tRatio, Ratio) CC_SYNTHESIZE(cocos2d::CCPoint, m_tOffset, Offset) CC_SYNTHESIZE(cocos2d::CCNode *, m_pChild, Child) // weak ref }; // Need to provide a constructor CCParallaxNodeExtras::CCParallaxNodeExtras() { cocos2d::CCParallaxNode(); // call parent constructor } CCParallaxNodeExtras* CCParallaxNodeExtras::node() { return new CCParallaxNodeExtras::CCParallaxNode(); } void CCParallaxNodeExtras::incrementOffset(cocos2d::CCPoint offset,CCNode *node){ for( unsigned int i = 0; i < m_pParallaxArray->num; i++) { CCPointObject *point = (CCPointObject *)m_pParallaxArray->arr[i]; CCNode *curNode = point->getChild(); if( curNode->isEqual(node) ) { point->setOffset( ccpAdd(point->getOffset(), offset) ); break; } } }
Please answer, I know that there is a lot of code above, but I want to know if I am doing something wrong. Any help or suggestion would be appreciated. Thanks!
Sincerely, Muhammad Tahir Ashraf
source share