如何删除错误C2593:在VC ++中,“运算符+ ="不明确 [英] how can i remove error C2593: 'operator +=' is ambiguous in VC++

查看:161
本文介绍了如何删除错误C2593:在VC ++中,“运算符+ ="不明确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用与消息WM_CHAR连接的此方法

此OnChar()是添加到我们的视图类中的事件处理程序

i want to use this method connected with message WM_CHAR

this OnChar() is the event handler addeed to our view Class

void CKeyStrokesView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
    // TODO: Add your message handler code here and/or call default
    CKeyStrokesDoc *pDoc = GetDocument();
    ASSERT_VALID(pDoc);
    pDoc->stringdata += nChar;
    Invalidate();
    CView::OnChar(nChar, nRepCnt, nFlags);
}


stringdata是CKeyStrokesDoc.h中声明的CString类型.

等待您的回覆

问候
Sangita


stringdata is of type CString declared in CKeyStrokesDoc.h

Waiting for ur Reply

Regards
Sangita

推荐答案

您将nChar定义为UINT,但是CString()对此没有重载.将行更改为
You define nChar as a UINT but CString() does not have an overload for this. Change the line to
pDoc->stringdata += (TCHAR)nChar;


尝试一下:):
Try it :) :
...
CString cszTemp;
cszTemp.Format(_T("%u;"), nChar);
pcDoc->m_strData += cszTemp;
...


这篇关于如何删除错误C2593:在VC ++中,“运算符+ ="不明确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆