I am writing a .NET assembly using C++/CLI (version 9.0), and I would like to use the PIMPL idiom to avoid putting unnecessary stuff in my public header. Unfortunately, when I try to forward declare a class, and then use a tracking handle to it, I get Linker warning 4248:
warning LNK4248: unresolved typeref token (0100000E) for 'MyNamespace.PrivateClass'; image may not run
This seems to be the case whether I use a CLI class or a native class for the implementation class.
Example code appears below:
namespace MyNamespace
{
ref class PrivateClass; // forward dec
ref class MyPublicClass
{
private:
PrivateClass^ m_Imp;
};
}
The Microsoft explanation for the warning is not too informative, unfortunately.