• Runtimes
  • Generic c++ runtime linker error

After creating a spine.lib and linking my engine to it, it seems to have trouble finding the RTTI_DECL macro

error LNK2001: unresolved external symbol "public: static class spine::RTTI const spine::MeshAttachment::rtti" (?rtti@MeshAttachment@spine@@2VRTTI@2@B)

In order to create the lib file I modified this line in dll.h:

#define SP_API __declspec(dllexport)

Did I miss something when doing this, has anybody seen this issue before?

Related Discussions
...
  • Изменено

How are you compiling the .lib file with VC++?

Yes, and the link libraries are defined with cmake


My problem was #define SP_API __declspec(dllexport) defines SP_API only as an export, so when my engine imports the DLL, it's actually exporting it instead. To fix this I needed to define SP_API as:

ifdef spine_EXPORTS

define SP_API DLLEXPORT

else

define SP_API DLLIMPORT

endif

This way it will export the functions when compiled, but import when my library imports them.