Ребята помогите плиз ! ! !
Пишет вот такие ошибки:
\natengine.cpp(14) : error C2143: syntax error : missing ';' before '*'
.\natengine.cpp(14) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
.\natengine.cpp(14) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
.\natengine.cpp(15) : error C2143: syntax error : missing ';' before '*'
.\natengine.cpp(15) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
.\natengine.cpp(15) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
.\natengine.cpp(33) : error C3861: 'CoInitialize': identifier not found
.\natengine.cpp(46) : error C2440: '=' : cannot convert from 'char [21]' to 'LPCWSTR'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
.\natengine.cpp(53) : error C2664: 'CreateWindowExW' : cannot convert parameter 2 from 'char [21]' to 'LPCWSTR'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
.\natengine.cpp(76) : error C3861: 'CoUninitialize': identifier not found
.\natengine.cpp(97) : error C3861: 'DX3DInitZ': identifier not found
.\natengine.cpp(99) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [25]' to 'LPCWSTR'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
.\natengine.cpp(108) : error C2227: left of '->Clear' must point to class/struct/union/generic type
type is 'int *'
.\natengine.cpp(108) : error C2065: 'D3DCLEAR_TARGET' : undeclared identifier
.\natengine.cpp(108) : error C2065: 'D3DCLEAR_ZBUFFER' : undeclared identifier
.\natengine.cpp(108) : error C3861: 'D3DCOLOR_XRGB': identifier not found
.\natengine.cpp(109) : error C2227: left of '->BeginScene' must point to class/struct/union/generic type
type is 'int *'
.\natengine.cpp(111) : error C2227: left of '->EndScene' must point to class/struct/union/generic type
type is 'int *'
.\natengine.cpp(114) : error C2227: left of '->Present' must point to class/struct/union/generic type
type is 'int *'
Вот листинг:
#include <windows.h>
#include "d3d9.h"
#include "d3dx9.h"
#include "C:\dxfunc.h"
#include "stdafx.h"
char szWindowClass[] = "Direct3D";
char szTitle[] = "Direct3D";
IDirect3D9 *pD3D = NULL;
IDirect3DDevice9 *pD3DDevice = NULL;
int iWidth=800;
int iHeight=600;
int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int nCmdShow);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
bool Init(HWND hWnd);
void GraphEngine();
int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int nCmdShow)
{
WNDCLASSEX wcex;
MSG msg;
HWND hWnd;
CoInitialize(NULL);
wcex.cbSize = sizeof(wcex);
wcex.style = CS_CLASSDC;
wcex.lpfnWndProc = (WNDPROC)WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInst;
wcex.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = NULL;
wcex.lpszMenuName = NULL;
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
if(!RegisterClassEx(&wcex))
return FALSE;
hWnd = CreateWindow(szWindowClass, szTitle, WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX,
CW_USEDEFAULT, CW_USEDEFAULT, iWidth, iHeight, NULL, NULL, hInst, NULL);
if(!hWnd)
return FALSE;
ShowWindow(hWnd, SW_NORMAL);
UpdateWindow(hWnd);
if(Init(hWnd) == TRUE)
{
while (true)
{
if (PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
if (msg.message == WM_QUIT) break;
}
GraphEngine();
}
}
if (pD3DDevice) {pD3DDevice= NULL; pD3DDevice=NULL;}
if (pD3D) {pD3D= NULL; pD3D=NULL;}
CoUninitialize();
return 0;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message) {
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
bool Init(HWND hWnd)
{
if (DX3DInitZ(&pD3D, &pD3DDevice, hWnd, iWidth, iHeight, FALSE)!=S_OK)
{
MessageBox(hWnd, "DirectX Initialize Error", "Error", MB_OK);
return FALSE;
}
return TRUE;
}
void GraphEngine()
{
pD3DDevice->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0,0,0), 1.0f, 0);
if (SUCCEEDED(pD3DDevice->BeginScene()))
{
pD3DDevice->EndScene();
}
pD3DDevice->Present(NULL, NULL, NULL, NULL);
}
|