次の方法で共有


コンパイラ エラー C3099

'keyword': マネージド属性には [System::AttributeUsageAttribute] を使用してください。WinRT 属性には [Windows::Foundation::Metadata::AttributeUsageAttribute] を使用してください。

注釈

AttributeUsageAttribute を使用して、/clr 属性を宣言します。 Windows::Foundation::Metadata::AttributeUsageAttribute を使用して、Windows ランタイム属性を宣言します。

/CLR 属性の詳細については、「ユーザー定義の属性」を参照してください。 Windows ランタイムでサポートされている属性については、「 Windows.Foundation.Metadata 名前空間」を参照してください

次の例では C3099 が生成され、修正方法が示されています。

// C3099.cpp
// compile with: /clr /c
using namespace System;
[usage(10)]   // C3099
// try the following line instead
// [AttributeUsageAttribute(AttributeTargets::All)]
ref class A : Attribute {};