Export (0) Print
Expand All
Expand Minimize

Compiler Error C3342

Error Message

'attribute': ambiguous attribute

The compiler found more than one definition of an attribute.

An attribute was defined more than once.

For more information, see User-Defined Attributes.

Example

The following sample generates 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 {};

Community Additions

ADD
Show:
© 2014 Microsoft