共用方式為


編譯器警告 (層級 1) C4581

已被取代的行為:'「string1」' 取代為 'string2' 來處理屬性

這個錯誤可能是因為針對 Visual Studio 2005 完成的編譯器一致性工作而產生:參數檢查 Visual C++ 屬性。

在舊版中,不論屬性值是否以引號括住,都已接受。 如果值是列舉,則不得以引號括住。

範例

下列範例會產生 C4581。

// C4581.cpp
// compile with: /c /W1
#include "unknwn.h"
[object, uuid("00000000-0000-0000-0000-000000000001")]
__interface IMyI : IUnknown {};

[coclass, uuid(12345678-1111-2222-3333-123456789012), threading("free")]   // C4581
// try the following line instead
// [coclass, uuid(12345678-1111-2222-3333-123456789012), threading(free)]
class CSample : public IMyI {};