Linker Tools Error LNK2033

unresolved typeref token (token) for 'type'

A type doesn't have a definition in MSIL metadata.

LNK2033 can occur when compiling with /clr:safe and where there is only a forward declaration for a type in an MSIL module, where the type is referenced in the MSIL module.

The type needs to be defined under /clr:safe.

For more information, see /clr (Common Language Runtime Compilation).

Example

The following sample generates LNK2033.

// LNK2033.cpp
// compile with: /clr:safe
// LNK2033 expected
ref class A;
ref class B {};

int main() {
   A ^ aa = nullptr;
   B ^ bb = nullptr;   // OK
};