Partager via


Erreur du compilateur C3451

Mise à jour : novembre 2007

Message d'erreur

'attribut' : impossible d'appliquer l'attribut non managé à 'type'
'attribute': cannot apply unmanaged attribute to 'type'

Un attribut C++ ne peut pas être appliqué à un type CLR. Pour plus d'informations, consultez C++ Attributes Reference.

Pour plus d'informations, consultez User-Defined Attributes.

Cette erreur peut être due à la mise en conformité du compilateur pour Visual C++ 2005 : l'attribut uuid (C++ Attributes) n'est plus autorisé sur un attribut défini par l'utilisateur à l'aide de la programmation CLR. Utilisez GuidAttribute à la place.

Pour plus d'informations, consultez Modifications avec rupture dans le compilateur Visual C++ 2005.

Exemple

L'exemple suivant génère l'erreur 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 {};