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

## Recommended Posts

Hi. I'm currently trying to make a simple game - but I've encountered a slight problem.. Without any errors visible to me, I get a linker error: error LNK2019: unresolved external symbol "public: bool __thiscall CSprite::LoadImageA(char *)" (?LoadImageA@CSprite@@QAE_NPAD@Z) referenced in function "public: bool __thiscall CEngine::Initialize(int,int,int,bool)" (?Initialize@CEngine@@QAE_NHHH_N@Z) I know what the error message MEANS (which is that it doesn't find the definition of a declared function), the problem is just that it seems to me that all is ok. I have made a class called CSprite, which are defined in the file sprite.h. I have made a source file called sprite.cpp, which includes sprite.h, and defines all the member functions. I then create a CSprite instance, and call the LoadImage function. Sprite class declaration:
class CSprite
{
private:
SDL_Surface *m_Bitmap;	//bitmap surface with all frames

public:
//constructors
CSprite();
CSprite(char * sPath);

void Draw(int x, int y, SDL_Surface *Screen);
};

Definition:
#include "sprite.h"

{
if (m_Bitmap == NULL)
{
return false;
}

return true;
}

(I didn't include the other functions here to save space) One thing I tried, which worked, was renaming the member function to LoadImageA (which is the exact name which appears in the linker error message). Any suggestions to what could be the problem here? :) Any help is appreciated. Regards

##### Share on other sites
It's probably one of the windows headers #define-ing LoadImage to LoadImageA (there are a few of these done by windows to select either ASCII (ending in A) or Unicode (ending in W) functions. You could try adding something like:
#endif

##### Share on other sites

Renaming the function to something else (like you have done) should fix it.

Ah right. :)

Thanks a bunch!

##### Share on other sites
By coincidence, somebody else posted about the same exact problem two weeks ago.

http://www.gamedev.net/community/forums/topic.asp?topic_id=439351