开发者

error C2819: type 'Robot::Animation' does not have an overloaded member 'operator ->'

I cannot for the heck of it find why this is throwing an error! Okay so I have a Struct that contains some objects. I then create a pointer to that struct and set the items one by one. By I keep getting an error. Here's the code:

Robot.h:

// Name and Animation info
std::map<std::string, Ogre::AnimationState*> mAnims2;

struct Animation {
    std::string name;   // The name of the animation state
    Ogre::AnimationState* mAnimState;   // The actual animation state
    bool FADE_IN;       // Fade the animation in
    bool FADE_OUT;      // Fade the animation out
};

Robot.cpp:

    // Go through the set by using iterator
while (animStateIter.hasMoreElements()) {
    // The Animation 开发者_运维问答object we will construct
    Animation* mAnimation = new Animation();
    // Initial values for Fading In and Out
    mAnimation->FADE_IN = false;    
    mAnimation->FADE_OUT = false;   
    // Create the Animation object, using the next animation in the list
    mAnimation->mAnimState = animStateIter.getNext();
    // Set the animations name
    mAnimation->name = Animation->mAnimState->getAnimationName();
    // Make sure the animation is set to Loop
    mAnimation->mAnimState->setLoop( true );
    // Insert the Animation object into the list of Animations
    mAnims2.insert( std::make_pair( mAnimation->name, mAnimation) );
    /* DEBUG */
    output << mAnimation->name << std::endl;
}

The Error:

Error 1 error C2819: type 'Robot::Animation' does not have an overloaded member 'operator ->' c:\users\masry\school-work\fall-2010\cs-425\homework-4\gameengine_solution\robot.cpp 52

Also if you noticed, I am trying to dynamically create Struct objects and insert them into a Map. I call:

Animation* mAnimation = new Animation();

in a while loop, is this good OO design? If not, what is a better way? Thank you.

EDIT: So, thanks to Frédéric, it turned out that I was missing a letter. but now I am getting an error saying:

Error   17  error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,unsigned char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::string'    c:\users\masry\school-work\fall-2010\cs-425\homework-4\gameengine_solution\robot.cpp    58


I think your error is there:

// Set the animations name
mAnimation->name = Animation->mAnimState->getAnimationName();

That probably should be:

// Set the animations name
mAnimation->name = mAnimation->mAnimState->getAnimationName();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜