Compiler Error C3238

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Compiler Error C3238.

type' : a type with this name has already been forwarded to assembly 'assembly'

A type was defined in a client application that is also defined, via type forwarding syntax, in a referenced assembly. Both types cannot be defined in the scope of the application.

See Type Forwarding (C++/CLI) for more information.

The following sample creates an assembly that contains a type that was forwarded from another assembly.

// C3238.cpp  
// compile with: /clr /LD  
public ref class R {};  

The following sample creates an assembly that used to contain the type definition, but not only contains type forwarding syntax.

// C3238_b.cpp  
// compile with: /clr /LD  
#using "C3238.dll"  
[ assembly:TypeForwardedTo(R::typeid) ];  

The following sample generates C3238.

// C3238_c.cpp  
// compile with: /clr /c  
// C3238 expected  
// Delete the following line to resolve.  
#using "C3238_b.dll"  
public ref class R {};  

Show: