編譯器警告 (層級 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 {};
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應