SOLVED - LNK2019: unresolved external symbol

SOLVED - LNK2019: unresolved external symbol
0.0 0


I don’t understand why I’m getting this error! Please help… Here are my steps.

I needed to get texture memory info based on how many images and fonts are loaded. I found a post on this site about this and copied the code to implement it.

I added a new method to CCTextureCache.cpp.
void VolatileTexture::dumpVolatileTextureInfo()


I then added the method definition to the CCTextureCache.h file in the VolatileTexture class.
static void dumpVolatileTextureInfo();

I then rebuild libcocos2d project and it rebuilds just fine.

I then go to helloworldscene.cpp and add the line.
VolatileTexture::dumpVolatileTextureInfo(); - this was picked up by intellisense no problem

I also included the CCTextureCache.h in the helloworldscene.cpp file just in case
#include “CCTextureCache.h”

I’ve verified that the helloworld project has the libcocos2d.lib file linked in

helloworld project builds but fails on the LINK stage with this error:

Error 45 error LNK2019: unresolved external symbol “public: static void cdecl cocos2d::VolatileTexture::dumpVolatileTextureInfo" referenced in function "public: virtual boolthiscall HelloWorld::init(void)” (?init@HelloWorld@@UAE_NXZ)

Please help me figure this out. I can’t see what I’ve missed.



Damn it! I figured it out. I’m slow! I did not realize that cocos2d-x was referenced via a dynamic link library and not via the lib file. I added CC_DLL to the new method in the header file and everything works. Sorry for wasting anyone’s time.