2013-03-05 76 views
0

每個教程中,我可以找到關於Box2D的說,要做到這一點,通過在世界的屍體進行迭代的:Box2D的Xcode中 - 使用未聲明的標識符「toDestroy」

std::set<b2Body*>toDestroy; //ERROR 

    for(b2Body *b = world->GetBodyList(); b; b=b->GetNext()) { 
     if (b->GetUserData() != NULL) { 
      CCSprite *sprite = (__bridge CCSprite *)b->GetUserData(); 

      if (sprite.tag == kWhateverTag) { 
       CCSprite *spriteData = (__bridge CCSprite *)b->GetUserData(); 
       spriteData.position = ccp(b->GetPosition().x * PTM_RATIO, 
             b->GetPosition().y * PTM_RATIO); 
       spriteData.rotation = -1 * CC_RADIANS_TO_DEGREES(b->GetAngle()); 

       if (self.shouldDestroy) { 
        toDestroy.insert(b); //ERROR 
       } 

      } 


     }  


    } 

但是我得到的錯誤"Use of undeclared identifier 'toDestroy'; did you mean 'tgaDestroy'?

我需要做些什麼來擺脫錯誤?

回答

0

這清除了錯誤:

#import <vector> 
#import <set> 
#import <algorithm> 
相關問題