syntax error: identifier "ccTime" (cocos2d-x simple game, Chapter 3)

Hello.

http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Chapter_3*-*How_to_Move_a_sprite

1> HelloWorldScene.cpp
1> c: dropbox coding cocos2d firstgame classes helloworldscene.h (29): error C2061: syntax error: identifier “ccTime”
1> c: dropbox coding cocos2d firstgame classes helloworldscene.cpp (71): error C2440: type cast: can not convert “void (__thiscall HelloWorld:: *) (void)” in “cocos2d:: SEL_SCHEDULE”
1> Pointers to members have different views, not to cast between them
1> c: dropbox coding cocos2d firstgame classes helloworldscene.cpp (133): error C2511: void HelloWorld:: gameLogic (cocos2d:: ccTime): overloaded member function not found in the “HelloWorld”
1> c: dropbox coding cocos2d firstgame classes helloworldscene.h (10): see declaration of “HelloWorld”
1> AppDelegate.cpp
1> c: dropbox coding cocos2d firstgame classes helloworldscene.h (29): error C2061: syntax error: identifier “ccTime”

what a problem with identifier “ccTime”?

Right - cocos2d::ccTime. :slight_smile:

Ha, I’m so lazy, usually “using namespace cocos2d;” at the start of each file, but forget to paste it in the tutorial.

I am trying this tutorial, and still getting this error. Even when “using namespace cocos2d;” or adding cocos2d::ccTime

Any guess why I am getting this error?

thanks in advance.

Walzer Wang wrote:

Ha, I’m so lazy, usually “using namespace cocos2d;” at the start of each file, but forget to paste it in the tutorial.

And now I reply to myself…. just in case someone else will have the same problem

to use this tutorial, we have to change the declaration of gameLogic to

void HelloWorld::gameLogic(float dt)

and this line into addTarget()

CCFiniteTimeAction* actionMove = CCMoveTo::actionWithDuration( actualDuration, ccp(0 - target->getContentSize().width/2, actualY) );

instead of

CCFiniteTimeAction* actionMove = CCMoveTo::actionWithDuration( (cocos2d::ccTime) actualDuration, ccp(0 - target->getContentSize().width/2, actualY) );

Other than that, great tutorial !

Alejandro Santiago wrote:

I am trying this tutorial, and still getting this error. Even when “using namespace cocos2d;” or adding cocos2d::ccTime
>
Any guess why I am getting this error?
>
thanks in advance.
>
>
Walzer Wang wrote:
> Ha, I’m so lazy, usually “using namespace cocos2d;” at the start of each file, but forget to paste it in the tutorial.