编译器警告(等级 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 {};