Jump to content
  • Advertisement
Sign in to follow this  
Juanu

PROBLEM WITH CONSTRUCTOR!

This topic is 4813 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

Ok.. so... what?? we decided to start from the beginning since we didn't have that much... i started a new project so that i copuld build a better engine with classes and stuff.. but i have one problem with my Class Constructor.. Here's the code:
[SOURCE]
//Constructor
Sprite::Sprite( int ANCHO, int ALTO, int DIST, char* ARCHIVO )
{
	//Establece principalmente, los valores pasados

	//La superficie de la imagen del sprite
	sprite = IMG_Load( ARCHIVO );
	if ( sprite == NULL )
	{
		fprintf( stderr, "Hubo un error al cargar la imagen en la clase Sprite: %s\n", SDL_GetError() );
	}

	//Transparencia
	SDL_SetColorKey( sprite, SDL_SRCCOLORKEY, SDL_MapRGB( sprite->format, 255, 0, 255 ) );

	//Rect del Sprite
	rctSprite.w = ANCHO;
	rctSprite.h = ALTO;
	rctSprite.x = 1;
	rctSprite.y = 1;

	//Dirección inicial del Sprite
	dir = DERECHA;

}
[/SOURCE]
[/source] And here is where I call it:
[SOURCE]

Sprite colitas( 41, 30, 1, "/data/gfx/colitas.png" );

[/SOURCE]
[/source] And i have a problem with the lin ker... this is the output: Engine_AnimaSprite warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library Engine_AnimaSprite error LNK2019: unresolved external symbol "public: __thiscall Sprite::~Sprite(void)" (??1Sprite@@QAE@XZ) referenced in function _SDL_main Engine_AnimaSprite fatal error LNK1120: 1 unresolved externals Any Ideas please!!???? For what i see ithere's a problem with the parameters i'm passing it becauise before I didn't pass any parameters at all and it compiled and linked just fine! Thanx!

Share this post


Link to post
Share on other sites
Advertisement
That means you haven't defined the destructor, you probably have a line like this:

virtual ~Sprite(); // Maybe without virtual


You have should also define the body for this function so add:

Sprite::~Sprite()
{

}


To the same place you have the constructor.

Share this post


Link to post
Share on other sites
PROBLEM SOLVED

That's for not paying attention


Engine_AnimaSprite error LNK2019: unresolved external symbol "public: __thiscall Sprite::~Sprite(void)" (??1Sprite@@QAE@XZ) referenced in function _SDL_main


IT's ALMOST LITERALLY SAYING! YOU DON'T HAVE A DESTRUCTOR !!!!!!!!!!
MAKE ONE!!!

Right there.,. after thiscall...

LOL...

THAN YOU VERY MUCH!!!

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!