Compartir a través de


Error del compilador C3451

Actualización: noviembre 2007

Mensaje de error

'atributo' : no se puede aplicar el atributo no administrado a 'tipo'
'attribute': cannot apply unmanaged attribute to 'type'

Un atributo de C++ no se puede aplicar a un tipo CLR. Vea C++ Attributes Reference para obtener más información.

Para obtener más información, vea User-Defined Attributes.

Este error también se puede producir como resultado del trabajo de conformidad del compilador realizado para Visual C++ 2005: el atributo uuid (C++ Attributes) ya no está permitido en un atributo definido por el usuario que utilice programación CLR. En su lugar, se ha de utilizar GuidAttribute.

Vea Cambios importantes en el compilador de Visual C++ 2005 para obtener más información.

Ejemplo

El ejemplo siguiente genera el error C3451.

// C3451.cpp
// compile with: /clr /c
using namespace System;
[ attribute(AttributeTargets::All) ]
public ref struct MyAttr {};

[ MyAttr, helpstring("test") ]   // C3451
// try the following line instead
// [ MyAttr ]
public ref struct ABC {};