MFC自定义函数怎么调用啊。。。其他语言转过来的
我用MFC做了一个小小的demo,点鼠标左键弹出对话框。
我在CHttptest11View自定义了一个函数
在CHttptest11View.h里写了声明
int getMo();
然后在CHttptest11View.cpp里写了实现
int CHttptest11View::getMo()
{
int i = 2;
return i;
}
我在OnLButtonDown里这样调用的
void CHttptest11View::OnLButtonDown(UINT nFlags, CPoint point)
{
int j = ::getMo();
CString s;
s.Format("%d", j);
MessageBox(s);
CView::OnLButtonDown(nFlags, point);
}
却一直报错
Compiling...
Httptest11View.cpp
F:\C++\Httptest11\Httptest11View.cpp(113) : error C2039: 'getMo' : is not a member of '`global namespace''
执行 cl.exe 时出错.
网上找了一下,说头文件有错
头文件如下:
#include "stdafx.h"
#include "Httptest11.h"
#include <string>
#include "Sms.h"
#include "Httptest11Doc.h"
#include "Httptest11View.h"
实在不知道哪里有错了