Hi,
In my project I have a function named GetObject that is wrapped in one of my classes in my static library. When I call the function in another project that is using my library, I got this error:
Error 1 error LNK2019: unresolved external symbol "public: class hamur::HamurObject * __thiscall hamur::HamurWorld::GetObjectA(class std::basic_string,class std::allocator > const &)" (?GetObjectA@HamurWorld@hamur@@QAEPAVHamurObject@2@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: virtual void __thiscall MainState::Draw(void)" (?Draw@MainState@@UAEXXZ) MainState.obj
As I understand problem is GetObject is a preprocessor definition in "windows.h" and it becomes GetObjectA instead.
My question is:
I have never added "windows.h" header to any of my files. I am using SDL, Fmod, OpenGL. I have found that it comes from SDL_opengl.h
I have tried to use:
#ifdef GetObject
#undef GetObject
#endif
It worked out. Is it a good or only possible solution? I am trying to implement a library that should work in multi-platforms but I didn't test to compile it for any platform other than Windows, so I am now quite worried about porting. It would be very nice to have some advice before the things got worse for porting...
My current environment is Windows Xp - Visual Studio 2008.
Thanks in Advance