Condividi tramite


Errore del compilatore C3451

'attribute': impossibile applicare l'attributo non gestito a 'type'

Un attributo C++ non può essere applicato a un tipo CLR. Per altre informazioni, vedere Riferimenti agli attributi C++.

Per altre informazioni, vedere User-Defined Attributes.

Questo errore può essere generato in seguito al lavoro di conformità del compilatore eseguito per Visual Studio 2005: l'attributo uuid non è più consentito in un attributo definito dall'utente usando la programmazione CLR. Utilizzare invece GuidAttribute.

Esempio

L'esempio seguente genera l'errore 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 {};