Partager via


Erreur du compilateur C3342

'attribute' : attribut ambigu

Le compilateur a détecté plusieurs définitions d’un attribut.

Un attribut a été défini plusieurs fois.

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

Exemple

L’exemple suivant génère l’erreur C3342 :

// C3342.cpp
// compile with: /clr /c
using namespace System;
using namespace System::Reflection;

[AttributeUsage(AttributeTargets::All)]
public ref class XAttribute : public  Attribute {};

[AttributeUsage(AttributeTargets::All)]
public ref class X : public Attribute {};

[X]   // C3342 could refer to X or XAttribute
// try the following line instead
// [XAttribute]
public ref class Class4 {};