When working with an existing project, having made some modifications to some external libraries, I am encountering issues of the following kind when building a library dependent upon another dynamically-linked library:
error LNK2001: unresolved external symbol "public: virtual void * __cdecl Foo::`scalar deleting destructor'(unsigned int)
error LNK2001: unresolved external symbol "public: virtual void * __cdecl Foo::`vector deleting destructor'(unsigned int)
If I run dumpbin /symbols
on the offending .obj
file I can clearly see these symbols as UNDEF
.
What is interesting to me is that there are no complaints of other undefined symbols, and the destructor for Foo
is not referenced at all in the object file symbol dump. The main references to these synthesized functions that I can find on StackOverflow are from people who have not defined their destructor, however I can clearly see Foo::Foo
being exported from the library where Foo
is defined (by running dumpbin /exports
on the .lib
).
This brings me to the core of my question: When does Visual Studio (2015) choose to synthesize these functions, and when does it decide that they should be linked from another translation unit?