1

我最近将一个托管 C++ 项目从 Visual Studio 2010 迁移到 2013。

在类的定义中,我有:

static enum class ItemType
{
    SHOP=IDS_SHOP,
    PAGE=IDS_PAGE,
    PHOTO=IDS_PHOTO
};


static bool EnumTryParse(CString sItemType, ItemType& refItemType)
{       
    System::String^ sType = gcnew System::String(sItemType);
    return System::Enum::TryParse(sType, refItemType);
}

试图编译它给了我错误。原因似乎是 2013 版本在幕后使用 C++11,它将托管 C++ 枚举类与 C++11 枚举类混淆了。

使我的代码适应新版本的正确方法是什么?

4

0 回答 0