mfc 中 “anwer”: 未声明的标识符
c++吧
全部回复
仅看楼主
level 1
void CDVExampleView::OnDraw(CDC* /*pDC*/)
{
CDVExampleDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: 在此处为本机数据添加绘制代码
int answer;
CString msg;
msg.Format("Add 100 to m_Data?")
anwer = AfxMessageBox(msg, MB_YESNO);
if(answer == IDYES)
{
pDoc->AddData(); //Document 调用一个对象的成员函数
}
msg.Format("m_Data = %d", pDoc->m_Data);
AfxMessageBox(msg);
}
vc 版本是 2010
出错内容 :
“anwer”: 未声明的标识符
error C2664: “void ATL::CStringT<BaseType,StringTraits>::Format(const wchar_t *,...)”: 不能将参数 1 从“const char [12]”转换为“const wchar_t *”1> with1> [1> BaseType=wchar_t,1> StringTraits=StrTraitMFC_DLL<wchar_t>1> ]1> 与指向的类型无关;转换要求 reinterpret_cast、C 样式转换或函数样式转换
2012年02月21日 04点02分 1
level 11
answer
2012年02月21日 04点02分 2
level 8
你这个写错了answer = AfxMessageBox(msg, MB_YESNO);
2012年02月21日 04点02分 3
level 1
修改了还是 出错呢
2012年02月21日 04点02分 4
level 10
#include <tchar.h>
msg.Format(TEXT("Add 100 to m_Data?"));
2012年02月21日 04点02分 5
level 1
还是 出错呢
dvexampleview.cpp(78): error C2664: “void ATL::CStringT<BaseType,StringTraits>::Format(const wchar_t *,...)”: 不能将参数 1 从“const char [12]”转换为“const wchar_t *”1> with1> [1> BaseType=wchar_t,1> StringTraits=StrTraitMFC_DLL<wchar_t>1> ]1> 与指向的类型无关;转换要求 reinterpret_cast、C 样式转换或函数样式转换
2012年02月21日 04点02分 6
level 8
你format的用法不对
2012年02月21日 04点02分 7
level 1
出错呢 ,只有 这一项了
dvexampleview.cpp(78): error C2664: “void ATL::CStringT<BaseType,StringTraits>::Format(const wchar_t *,...)”: 不能将参数 1 从“const char [12]”转换为“const wchar_t *”1> with1> [1> BaseType=wchar_t,1> StringTraits=StrTraitMFC_DLL<wchar_t>1> ]1> 与指向的类型无关;转换要求 reinterpret_cast、C 样式转换或函数样式转换
2012年02月21日 04点02分 8
level 1
那 怎么 写呢,我按照 书上抄的呢 。。。
2012年02月21日 04点02分 9
level 1
msg.Format("m_Data = %d", pDoc->m_Data);
.出错 怎么解决呢
2012年02月21日 05点02分 10
level 1
msg.Format (TEXT("m_Data = %d", pDoc->m_Data));
这样吗 ?
还是 出错 。。。
2012年02月21日 05点02分 12
level 1
void CDVExampleView::OnDraw(CDC* /*pDC*/){CDVExampleDoc* pDoc = GetDocument();ASSERT_VALID(pDoc);
// TODO: 在此处为本机数据添加绘制代码
int answer;CString msg;
#include <tchar.h>
msg.Format(TEXT("Add 100 to m_Data?")); answer = AfxMessageBox(msg, MB_YESNO);
if(answer == IDYES)
{pDoc->AddData();//Document 调用一个对象的成员函数}
msg.Format("m_Data = %d", pDoc->m_Data);AfxMessageBox(msg);}
看下 ,
2012年02月21日 05点02分 14
level 1
HAHA , 我可以加你为好友马
2012年02月21日 05点02分 16
1