In my project, I have a function called GetObject that is wrapped in one of my classes in my static library. When I call the function in another project that uses my library, I got this error:
Error 1 error LNK2019: unresolved external character "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) function link public: virtual void __thiscall MainState :: Draw (void ) "(? Draw @MainState @@ UAEXXZ) MainState.obj
As I understand it, the GetObject problem is the preprocessor definition in "windows.h", and instead it becomes GetObjectA.
My question is:
I have never added the title "windows.h" to any of my files. I use SDL, Fmod, OpenGL. I found that this comes from SDL_opengl.h
I tried using:
#ifdef GetObject
#undef GetObject
#endif
It worked. Is this a good or only possible solution? I am trying to implement a library that should run on multiple platforms, but I have not tested it for any platform other than Windows, so now I am very worried about porting. It would be really nice to have some advice before things got worse for porting ...
My current environment is Windows Xp - Visual Studio 2008.
Thanks at Advance
source
share