VC++6.0新手有个问题求教

来源:百度知道 编辑:UC知道 时间:2024/05/23 00:00:08
这是一个使用DirectDraw的程序
#define WIN32_LEAN_AND_MEAN
#define INITGUID
#include <windows.h>
#include <windowsx.h>
#include <mmsystem.h>
#include <iostream.h>
#include <conio.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
#include <math.h>
#include <io.h>
#include <fcntl.h>

#include <ddraw.h>

#define WINDOW_CLASS_NAME "winclass1"
typedef unsigned short USHORT;
typedef unsigned short WORD;
typedef unsigned char UCHAR;
typedef unsigned char BYTE;

#define DD_INIT_STRUCT(ddstruct) //下面两行本接在此处
{memset(&ddstruct,0,sizeof(ddstruct));ddstruct.dwSize=
sizeof(ddstruct); }

LPDIRECTDRAW7 lpdd = NULL;//VC++6.0提示的错误都指着这句

共有三个错误:1:miss

要编译通过你必须要些lib来支持,当然,你可以安装Microsoft DirectX 7 SDK或者
Microsoft DirectX 8 SDK,安装过程中你可以只安装你需要的部分,安装过程中会告诉你是否
把lib加到vc(如果你已经安装了vc),选择"yes",这样你的程序就可以编译通过。

#define DD_INIT_STRUCT(ddstruct) //下面两行本接在此处
{memset(&ddstruct,0,sizeof(ddstruct));ddstruct.dwSize=
sizeof(ddstruct); }

这里有错误,宏定义换行要这样:

//下面两行本接在此处
#define DD_INIT_STRUCT(ddstruct) \
{memset(&ddstruct,0,sizeof(ddstruct));ddstruct.dwSize= \
sizeof(ddstruct); }

且'\'的后面不能加注释,
另外,你要是从别处拷贝来的代码,要把空格全部退掉在回车。

总而言之,言而总之,就是LPDIRECTDRAW7没定义
这个类(或者其他数据类型)看看是哪里的

同意pigkiller
我认为是你的那个LPDIRECTDRAW7数据类型写错了,或许是拼写错误,或许是你的这个数据类型在了、库文件中缺失