bar.dll project is compiled as C, or else includes foo.lib's headers under extern "C" {...}
. Essentially, one project exports the function as having C++ linkage, while the other tries to import it with C linkage.
Visual C++ 2008 can't include its own static library
-
04-06-2022 - |
Question
I have two projects: a static library and a DLL that will link statically to this static library. Let's assume:
foo.lib (static library)
bar.dll (links against foo.lib)
foo.lib has the following function:
fooFile(...);
I successfully built the statically lib and dumpbin /symbols tells me that the function is there (although with some name mangling). When trying to link it against the bar.dll project, I get the following error:
error LNK2019: unresolved external symbol _fooFile referenced in function _fooSomething
Why is this failing? The same code works without issues in a Linux environment.
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow