C++编译问题,在线等待!!
//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,看半天看不懂哪里错了,望高手指导!!
...全文
相关推荐
VScode编译C++ 头文件显示not found的问题
主要介绍了VScode编译C++ 头文件显示not found的问题,本文给大家分享问题解决方法,通过截图的形式给大家介绍的非常详细,需要的朋友可以参考下
yaml-cpp库的编译&安装
yaml-cpp库的编译&安装 一、 下载 二、 解压缩 三、 编译&安装 四、 使用说明
Dev-Cpp C++编译器
C++ 编译器, Dev-Cpp 5.10版 。
linux下使用g++编译cpp工程的方法
C++编程中相关文件后缀 1.单个源文件生成可执行程序 下面是一个保存在文件 helloworld.cpp 中一个简单的 C++ 程序的代码: /* helloworld.cpp */ #include <iostream> int main(int argc,char *argv[]) { std::cout << "hello, world" << std::endl; return(0); } 程序使用定义在头文件 iostream 中的 cout,向标准输出写入一个简单的字符串。该代码可用以下命令编译为可执行文件: $ g++ helloworld.cpp 编译器 g++
使用VSCode在线编译调试IAR工程.docx
使用VScode软件进行IAR工程的在线编译和下载调试(基于J-link)


