I am getting unexpected linker errors after refactoring my solution from 1 to 3 projects. In this first instance I get two unresolved tokens, like
error LNK2020: unresolved token (0600000C) Mynamespace.MyClass::unresolvedStaticFunc
error LNK2020: unresolved token (0600000C) Mynamespace.MyClass::unresolvedOtherStaticFunc
fatal error LNK1120: 2 unresolved externals
I have not touched this class in my refactoring. Both methods are declared static in the header but not the body (cpp file).
I’ve rechecked my errors and the new project is compiling fine but forcing the old one to break on linking.
I think I need to add files to my new projects but they seem nicely separated into their own folders now. Another project for the shared class perhaps? I am adding what I thought a simple feature and my project count has already tripled.
You should not be
#includeing header files containing managed types across multiple projects. Instead, in the new project, add an assembly reference to the old project; this way, the type information will be gathered from the .NET metadata embedded into the old project’s assembly.