譬如这样子的——
aaaDlg.h
class aaaDlg
{
public:
static void bbb();
};aaaDlg.cpp
#include "aaaDlg.h"
void aaaDlg::bbb()
{
m_grid.ShowWindow(SW_SHOW);//变量m_grid对应一个FlexGrid的ActiveX控件
}build后有error C2228:left of '.ShowWindow' must have class/struct/union type,去掉那个static后正常!
这是为什么咧?
aaaDlg.h
class aaaDlg
{
public:
static void bbb();
};aaaDlg.cpp
#include "aaaDlg.h"
void aaaDlg::bbb()
{
m_grid.ShowWindow(SW_SHOW);//变量m_grid对应一个FlexGrid的ActiveX控件
}build后有error C2228:left of '.ShowWindow' must have class/struct/union type,去掉那个static后正常!
这是为什么咧?
但为什么不是 illegal call of non-static member function 呢?还有,我在ccc.cpp将有一个
void CcccButton::OnMouseMove
{
aaaDlg::bbb
}
要怎么写,才能避免 static 和 non-static 犯错呢?GG不要卖呆了,帮我看看吧!
又会有 error C2143: syntax error : missing ';' before '.'
出现在aaaDlg.bbb(),
不是aaaDlg::bbb()
之类的错误除了笔误,大多都是没有include相应的文件造成的。还有就是{可能布匹配,或者前一句的语法有问题,编译器当做其他意思解释了,后面的解释不通了,编译器才报错。
2.成员函数 CcccButton::OnMouseMove 里就加了这么一句,没有“前一句”
不大可能{不匹配,或者前一句的语法有问题