|  | 
 
 
 楼主|
发表于 2003-10-3 08:12:00
|
显示全部楼层 
Re:VC++ 2003如何设置DXSDK
| 源程序如下,我还只是写个开头做试验就遇到这样错误,谁能帮我看看是什么回事 #include <windows.h>
 
 LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
 BOOL InitWindows (HINSTANCE, INT);
 int MainLoop();
 
 LPDIRECT3D8 g_pD3D8 = NULL;
 HWND hwnd;
 MSG msg;
 
 int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLine, int CmdShow)
 {
 if (InitWindows (hInstance, CmdShow))
 {
 MainLoop();
 }
 else
 {
 MessageBox (GetActiveWindow(), "InitWindows() FALSE","Error",MB_OK);
 }
 }
 
 BOOL InitWindows(HINSTANCE hInstance, int CmdShow)
 {
 WNDCLASSEX wndclass;
 wndclass.cbClsExtra = 0;
 wndclass.cbSize = sizeof (WNDCLASSEX);
 wndclass.cbWndExtra = 0;
 wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);
 wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
 wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION);
 wndclass.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
 wndclass.hInstance = hInstance;
 wndclass.lpfnWndProc = WndProc;
 wndclass.lpszClassName = "mainwndclass";
 wndclass.lpszMenuName = NULL;
 wndclass.style = CS_HREDRAW|CS_VREDRAW;
 
 if (!RegisterClassEx (&wndclass))
 return FALSE;
 
 hwnd = CreateWindowEx (0, "mainwndclass", "Test", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
 CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance,NULL);
 if (!hwnd)
 return FALSE;
 ShowWindow (hwnd,CmdShow);
 UpdateWindow (hwnd);
 }
 
 int MainLoop()
 {
 while (GetMessage (&msg,hwnd, 0, 0))
 {
 TranslateMessage (&msg);
 DispatchMessage (&msg);
 }
 return 0;
 }
 
 LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
 switch (message)
 {
 case WM_DESTROY:
 PostQuitMessage (0);
 return 0;
 }
 DefWindowProc (hwnd, message, wParam, lParam);
 }
 
 ------ 已启动生成: 项目: w32-1, 配置: Debug Win32 ------
 
 正在编译...
 main.cpp
 e:\Visual file\VCfile\w32-1\main.cpp(7) : error C2146: 语法错误 : 缺少“;”(在标识符“g_pD3D8”的前面)
 e:\Visual file\VCfile\w32-1\main.cpp(7) : error C2501: “LPDIRECT3D8” : 缺少存储类或类型说明符
 e:\Visual file\VCfile\w32-1\main.cpp(7) : error C2501: “g_pD3D8” : 缺少存储类或类型说明符
 
 生成日志保存在“file://e:\Visual file\VCfile\w32-1\Debug\BuildLog.htm”中
 w32-1 - 3 错误,0 警告
 
 
 ---------------------- 完成 ---------------------
 
 生成: 0 已成功, 1 已失败, 0 已跳过
 | 
 |