我使用VS2008在Windows 10 我有这个功能的问题,希望你能帮助我使用`auto`产生错误C4430:缺少类型说明符 - 假定为int。注意:C++不支持默认int
void CPythonNetworkStream::AppearShopSign(DWORD dwVID, std::string stSign) {
if (stSign.empty())
for (auto it = m_mapShopSign.begin(); it != m_mapShopSign.end(); ++it)
if (dwVID == it->first)
stSign = it->second;
// LogBoxf("AppearShopSign: %u-%s", dwVID, stSign.c_str());
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "BINARY_PrivateShop_Appear", Py_BuildValue("(is)", dwVID, stSign.c_str()));
}
错误消息
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2440: 'initializing' : cannot convert from 'std::_Tree<_Traits>::iterator' to 'int'
error C2678: binary '!=' : no operator found which takes a left-hand operand of type 'int' (or there is no acceptable conversion)
error C2227: left of '->first' must point to class/struct/union/generic type
VS 2008不支持'auto'类型说明符。 – LogicStuff
'auto it'不支持VC++ 2008.您需要升级到其中一个最新版本。 –
@LogicStuff它可能确实支持'auto'的原始C含义,但这不是OP所尝试使用的。 –