skovv Temat założony przez niniejszego użytkownika |
[dxdx9,VC++ 2010 EXPRESS]błędy winnt.h » 2010-08-25 19:17:46 Za każdym razem gdy chcę użyć Direct3D(chcę wkońcu coś w nim napisać...) mam takie oto błędy(wcześniej oczywiście daje ścieżki do includów i libów oraz dodaje liby ------ Build started: Project: DirteX, Configuration: Debug Win32 ------ DirteX.cpp C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(290): error C2146: syntax error : missing ';' before identifier 'PVOID64' C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(290): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(8992): error C2146: syntax error : missing ';' before identifier 'Buffer' C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(8992): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(8992): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int DirteX.cpp(18): error C2440: '=' : cannot convert from 'const char [9]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast DirteX.cpp(27): error C2664: 'CreateWindowExW' : cannot convert parameter 2 from 'const char [9]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
|
|
DejaVu |
» 2010-08-25 19:56:22 1) Czy ściągnąłeś dobrego DirectX'a - SDK? 2) Czy masz dobrą kolejność include'ów? 3) Czy masz dobrze skonfigurowane projekty (multibyte char/unicode)? |
|
skovv Temat założony przez niniejszego użytkownika |
» 2010-08-25 21:05:35 1.DirectX 9.0 SDK #include <d3dx9.h> #pragma comment (lib, "d3d9.lib") #pragma comment (lib, "d3dx9.lib")
2.Tylko to includuje :) 3.Nie rozumiem. Jeśli chodzi o projekt to stworzyłem Empty Project, dolinkowałem liby i includy, stworzyłem plik main.cpp i dla testu wkleiłem kod z tutoriala: #include <d3dx9.h> #pragma comment (lib, "d3d9.lib") #pragma comment (lib, "d3dx9.lib")
IDirect3D9 * pD3D; IDirect3DDevice9 * pDev;
HWND hWnd;
void InitWindow() { HINSTANCE hProg = GetModuleHandle( 0 ); WNDCLASS wc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hProg; wc.lpfnWndProc = DefWindowProc; wc.lpszClassName = "WndClass"; wc.lpszMenuName = 0; wc.hbrBackground =( HBRUSH ) GetStockObject( BLACK_BRUSH ); wc.hIcon = LoadIcon( hProg, IDI_WINLOGO ); wc.style = CS_HREDRAW | CS_VREDRAW; wc.hCursor = LoadCursor( hProg, IDC_ARROW ); RegisterClass( & wc ); hWnd = CreateWindowEx( 0, "WndClass", "Lekcja 1", WS_OVERLAPPEDWINDOW, 0, 0, 800, 600, 0, 0, hProg, 0 ); ShowWindow( hWnd, 5 ); }
bool Run = true;
int __stdcall WinMain( HINSTANCE, HINSTANCE, LPSTR, int ) { InitWindow(); pD3D = Direct3DCreate9( D3D_SDK_VERSION ); D3DPRESENT_PARAMETERS d3dpp; ZeroMemory( & d3dpp, sizeof( d3dpp ) ); d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.Windowed = true; d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8; pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, & d3dpp, & pDev ); MSG msg; while( Run ) { if( PeekMessage( & msg, 0, 0U, 0U, PM_REMOVE ) ) { if( msg.message == WM_DESTROY ) break; TranslateMessage( & msg ); DispatchMessage( & msg ); } else { pDev->Clear( 0, 0, D3DCLEAR_TARGET, 0xff00ff00, 1, 0 ); pDev->BeginScene(); pDev->EndScene(); pDev->Present( 0, 0, 0, 0 ); if( GetKeyState( VK_ESCAPE ) & 0x0800 ) { Run = false; } } } pDev->Release(); pD3D->Release(); } |
|
DejaVu |
» 2010-08-25 21:09:03 |
|
skovv Temat założony przez niniejszego użytkownika |
» 2010-08-26 09:31:45 nadal to samo :/ |
|
malan |
» 2010-08-26 13:06:21 Pobrałem najnowsze DirectX SDK ( download). Odpaliłem C::B. Stworzyłem projekt Direct/X (podając ścieżkę do SDK). Wkleiłem Twój kod. Błędy kompilacji: Microsoft DirectX SDK (June 2010)\include\d3d9types.h|25|warning: ignoring #pragma warning | Microsoft DirectX SDK (June 2010)\include\d3d9types.h|2411|warning: ignoring #pragma warning | Microsoft DirectX SDK (June 2010)\include\d3d9.h|2025|warning: "/*" within comment| Microsoft DirectX SDK (June 2010)\include\d3d9.h|2026|warning: "/*" within comment| Microsoft DirectX SDK (June 2010)\include\d3dx9math.h|19|warning: ignoring #pragma warning | Microsoft DirectX SDK (June 2010)\include\d3dx9math.h|1792|warning: ignoring #pragma warning | Microsoft DirectX SDK (June 2010)\include\d3dx9core.h|669|warning: multi-line comment| main.cpp|2|warning: ignoring #pragma comment | main.cpp|3|warning: ignoring #pragma comment | Microsoft DirectX SDK (June 2010)\include\d3dx9math.inl|993|warning: 'operator new' must not return NULL unless it is declared 'throw()' (or -fcheck-new is in effect)| Microsoft DirectX SDK (June 2010)\include\d3dx9math.inl|1008|warning: 'operator new' must not return NULL unless it is declared 'throw()' (or -fcheck-new is in effect)| ||=== Build finished: 0 errors, 11 warnings ===|
Ujrzałem zielone okienko. |
|
skovv Temat założony przez niniejszego użytkownika |
» 2010-08-26 13:18:42 ten kod jest z przykładu :) I chodzi właśnie o to że pod C::B działa, ale nie da się tam za wiele zrobić. W Visualu da się zrobić wieeele w d3d ale mi nie działa... nigdzie indziej nie ma takich błędów :/ i piszczy o ten plik: winnt.h . Może ten jest jakiś uszkodzony? Jeśli ci działa to mógłbyś mi podesłać swój plik? Może zadziała :) Z góry dzięki |
|
malan |
» 2010-08-26 13:23:21 Tak... to było dziwne. Odpaliłem MV C++ 2008 EE, który pobrałem wczoraj. Wkleiłem kod i skompilowałem... Działa. Bez żadnego linkowania, podawania ścieżek do SDK itp. Zapewne sam sobie odczytał :). |
|
« 1 » 2 |