C++编译问题,在线等待!!

MOMO籽 MOMO籽 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

//momogame.h
namespace Wnd
{
const DWORD LEFT =-1, TOP = -2;
const DWORD RIGHT = -3, DOWN = -4;
const DWORD XCENTRE = -5, YCENTRE = -6;
const DWORD DEFULT = CW_USEDEFAULT;
DWORD CountWndPos( DWORD pos, const GameWindow *wnd, const GameWindow *parentwnd );
}
//load.cpp
DWORD Wnd::CountWndPos( DWORD pos, const GameWindow *wnd, const GameWindow *parentwnd = NULL )
{
if( wnd == NULL)
return pos;
DWORD with = wnd ->GetWith();
DWORD height = wnd ->GetHeight();
if( parent == NULL )
{
parentwith = GetSystemMetrics(SM_CXSCREEN);
parentheight = GetSystemMetrics(SM_CYSCREEN);
}
else
{
DWORD parentwith = parentwnd ->GetWith();
DWORD parentheight = parentwnd ->GetHeight();
}
switch( pos )
{
case XCENTRE:
return ( parentwith - with )/2;
case YCENTRE:
return ( parentheight - height )/2;
case DEFULT:
return DEFULT;
case LEFT:
case TOP:
return 0;
case RIGHT:
return parentwith - with;
case DOWN:
return parentheight - height;
}
return pos;
}

VS2008编译上面代码时出现
1>d:\vc++工作文件夹\my_dx\momogame.h(23) : error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>d:\vc++工作文件夹\my_dx\momogame.h(23) : error C2143: 语法错误 : 缺少“,”(在“*”的前面)
1>d:\vc++工作文件夹\my_dx\load.cpp(4) : error C2244: “CountWndPos”: 无法将函数定义与现有的声明匹配
1> d:\vc++工作文件夹\my_dx\load.cpp(3) : 参见“CountWndPos”的声明
1>d:\vc++工作文件夹\my_dx\load.cpp(4) : fatal error C1903: 无法从以前的错误中恢复;正在停止编译

其中Wnd声明在momogame.h,CountWndPos实现在load.cpp,看半天看不懂哪里错了,望高手指导!!
...全文

相关推荐

评论 12
收藏 已收藏
分享
返回顶部
MOMO籽
C++ 语言 65,214 成员 250,514 内容