Jump to content
  • Advertisement
Sign in to follow this  
sheep19

multiple initialization proble m

This topic is 3317 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

my Animation class has these constructors:
// constructor
		Animation(Sint16 x = 0, Sint16 y = 0, uint reserve = 3);
		Animation(const Point &pos, uint reserve = 3);

// _pos is an object of type Point
// constructor #1
Animation::Animation(Sint16 x, Sint16 y, uint reserve)
: _pos(x, y), _current(0)
{
	_SprVec.reserve(reserve); // reserve space for sprites
}

// constructor #2
Animation::Animation(const Point &pos, uint reserve)
: _pos(pos), _current(0)
{
	_SprVec.reserve(reserve);
}
Animation anim(Point(10, 0), 10);
error C2374: 'anim' : redefinition; multiple initialization 1> .\main.cpp(175) : see declaration of 'anim' What's wrong?

Share this post


Link to post
Share on other sites
Advertisement
Post your main.cpp file in its entirety, along with the header and source files for the Animation class.

Share this post


Link to post
Share on other sites
Quote:
Original post by sheep19

Animation anim(Point(10, 0), 10);


error C2374: 'anim' : redefinition; multiple initialization
1> .\main.cpp(175) : see declaration of 'anim'



What's wrong?


My guess is you have tried to declare anim twice in the same scope. See C2374.

Share this post


Link to post
Share on other sites
Quote:
Original post by _fastcall
Quote:
Original post by sheep19

Animation anim(Point(10, 0), 10);


error C2374: 'anim' : redefinition; multiple initialization
1> .\main.cpp(175) : see declaration of 'anim'



What's wrong?


My guess is you have tried to declare anim twice in the same scope. See C2374.


That was it, thanks a lot. I was using the same name in the same scope.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!