steckel Temat założony przez niniejszego użytkownika |
Microsoft Visual C++ 2008 Express Edition - Cuda i dziwy » 2009-09-02 20:37:20 Próbując nauczyć się DirectX z tej strony: http://www.gamedev.pl/tutorials.php?x=view&id=328napotkałem się na coś dziwnego. Gdy otworzyłem plik projektu z tego kursu poprzez Microsoft Visual C++ 2008 Express Edition to projekt skompilował się bez problemu. Natomiast gdy stworzyłem nowy projekt (windows application) i dodałem do niego main.cpp ze ściągniętego pliku (To był jedyny plik źródłowy) to mi wyskoczyły błędy podobne do tych, które miałem przy Allegro5. Czy jest ktoś w stanie to wyjaśnić? #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(); }
//edit Gdy dodałem spację na koniec do tego gotowego projektu to znowu pojawiają się te błędy. Gdy zamykam środowisko i otwieram na nowo ten gotowy projekt to też się nie chce skompilować. Muszę rozpakować z archiwum, aby znowu działało. To jest szalone! //edit2 Dałem opcję naprawy Microsoft Visual C++ 2008 Express Edition, lecz to nic nie pomogło ;/ |
|
DejaVu |
» 2009-09-02 22:51:31 Podaj konkretnie jakie błędy dostajesz. |
|
steckel Temat założony przez niniejszego użytkownika |
» 2009-09-03 15:24:42 1 >------Build started: Project: 1, Configuration: Release Win32------ 1 > Compiling... 1 > main.cpp 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winnt.h( 3035 ) : warning C4103 : 'c:\program files\microsoft visual studio 9.0\vc\include\winnt.h' : alignment changed after including header , may be due to missing # pragma pack( pop ) 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winnt.h( 3327 ) : warning C4103 : 'c:\program files\microsoft visual studio 9.0\vc\include\winnt.h' : alignment changed after including header , may be due to missing # pragma pack( pop ) 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winnt.h( 3423 ) : warning C4068 : unknown pragma 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winnt.h( 3428 ) : warning C4068 : unknown pragma 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winbase.h( 1252 ) : error C2144 : syntax error : 'void' should be preceded by ';' 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winbase.h( 1252 ) : error C4430 : missing type specifier - int assumed.Note : C++does not support default - int 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winbase.h( 1253 ) : error C2144 : syntax error : 'void' should be preceded by ';' 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winbase.h( 1253 ) : error C4430 : missing type specifier - int assumed.Note : C++does not support default - int 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winbase.h( 1253 ) : error C2086 : 'int DECLSPEC_NORETURN' : redefinition 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winbase.h( 1252 ) : see declaration of 'DECLSPEC_NORETURN' 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winbase.h( 1313 ) : error C2144 : syntax error : 'void' should be preceded by ';' 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winbase.h( 1313 ) : error C4430 : missing type specifier - int assumed.Note : C++does not support default - int 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winbase.h( 1313 ) : error C2086 : 'int DECLSPEC_NORETURN' : redefinition 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winbase.h( 1252 ) : see declaration of 'DECLSPEC_NORETURN' 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\rpcdce.h( 366 ) : error C2144 : syntax error : 'void' should be preceded by ';' 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\rpcdce.h( 366 ) : error C4430 : missing type specifier - int assumed.Note : C++does not support default - int 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\rpcdce.h( 366 ) : error C2086 : 'int DECLSPEC_NORETURN' : redefinition 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winbase.h( 1252 ) : see declaration of 'DECLSPEC_NORETURN' 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\rpcdcep.h( 89 ) : error C3646 : 'I_RpcAllocate' : unknown override specifier 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\rpcdcep.h( 89 ) : error C2091 : function returns function 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\rpcdcep.h( 89 ) : error C4430 : missing type specifier - int assumed.Note : C++does not support default - int 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\shellapi.h( 129 ) : warning C4103 : 'c:\program files\microsoft visual studio 9.0\vc\include\shellapi.h' : alignment changed after including header , may be due to missing # pragma pack( pop ) 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\shellapi.h( 265 ) : warning C4103 : 'c:\program files\microsoft visual studio 9.0\vc\include\shellapi.h' : alignment changed after including header , may be due to missing # pragma pack( pop ) 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 524 ) : error C3646 : 'inet_ntoa' : unknown override specifier 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 524 ) : error C2091 : function returns function 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 524 ) : error C4430 : missing type specifier - int assumed.Note : C++does not support default - int 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 524 ) : error C2733 : second C linkage of overloaded function 'DECLARE_STDCALL_P' not allowed 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 524 ) : see declaration of 'DECLARE_STDCALL_P' 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 533 ) : error C3646 : 'gethostbyaddr' : unknown override specifier 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 533 ) : error C2091 : function returns function 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 533 ) : error C4430 : missing type specifier - int assumed.Note : C++does not support default - int 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 533 ) : error C2733 : second C linkage of overloaded function 'DECLARE_STDCALL_P' not allowed 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 533 ) : see declaration of 'DECLARE_STDCALL_P' 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 534 ) : error C3646 : 'gethostbyname' : unknown override specifier 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 534 ) : error C2091 : function returns function 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 534 ) : error C4430 : missing type specifier - int assumed.Note : C++does not support default - int 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 534 ) : error C2556 : 'int (__cdecl *DECLARE_STDCALL_P(hostent *))(const char *)' : overloaded function differs only by return type from 'int (__cdecl *DECLARE_STDCALL_P(hostent *))(const char *,int,int)' 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 533 ) : see declaration of 'DECLARE_STDCALL_P' 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 534 ) : error C2371 : 'DECLARE_STDCALL_P' : redefinition; different basic types 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 533 ) : see declaration of 'DECLARE_STDCALL_P' 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 535 ) : error C3646 : 'getservbyport' : unknown override specifier 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 535 ) : error C2091 : function returns function 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 535 ) : error C4430 : missing type specifier - int assumed.Note : C++does not support default - int 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 535 ) : error C2733 : second C linkage of overloaded function 'DECLARE_STDCALL_P' not allowed 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 535 ) : see declaration of 'DECLARE_STDCALL_P' 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 536 ) : error C3646 : 'getservbyname' : unknown override specifier 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 536 ) : error C2091 : function returns function 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 536 ) : error C4430 : missing type specifier - int assumed.Note : C++does not support default - int 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 536 ) : error C2556 : 'int (__cdecl *DECLARE_STDCALL_P(servent *))(const char *,const char *)' : overloaded function differs only by return type from 'int (__cdecl *DECLARE_STDCALL_P(servent *))(int,const char *)' 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 535 ) : see declaration of 'DECLARE_STDCALL_P' 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 536 ) : error C2371 : 'DECLARE_STDCALL_P' : redefinition; different basic types 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 535 ) : see declaration of 'DECLARE_STDCALL_P' 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 537 ) : error C3646 : 'getprotobynumber' : unknown override specifier 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 537 ) : error C2091 : function returns function 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 537 ) : error C4430 : missing type specifier - int assumed.Note : C++does not support default - int 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 537 ) : error C2733 : second C linkage of overloaded function 'DECLARE_STDCALL_P' not allowed 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 537 ) : see declaration of 'DECLARE_STDCALL_P' 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 538 ) : error C3646 : 'getprotobyname' : unknown override specifier 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 538 ) : error C2091 : function returns function 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 538 ) : error C4430 : missing type specifier - int assumed.Note : C++does not support default - int 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 538 ) : error C2556 : 'int (__cdecl *DECLARE_STDCALL_P(protoent *))(const char *)' : overloaded function differs only by return type from 'int (__cdecl *DECLARE_STDCALL_P(protoent *))(int)' 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 537 ) : see declaration of 'DECLARE_STDCALL_P' 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 538 ) : error C2371 : 'DECLARE_STDCALL_P' : redefinition; different basic types 1 > C:\P rogram Files\Microsoft Visual Studio 9.0\VC\include\winsock2.h( 537 ) : see declaration of 'DECLARE_STDCALL_P' 1 > c:\p rogram files\microsoft directx sdk( march 2009 ) \i nclude\d3dx9shader.h( 955 ) : error C2146 : syntax error : missing ';' before identifier 'HRESULT' 1 > c:\p rogram files\microsoft directx sdk( march 2009 ) \i nclude\d3dx9shader.h( 955 ) : error C4430 : missing type specifier - int assumed.Note : C++does not support default - int 1 > c:\p rogram files\microsoft directx sdk( march 2009 ) \i nclude\d3dx9shader.h( 964 ) : error C2146 : syntax error : missing ';' before identifier 'HRESULT' 1 > c:\p rogram files\microsoft directx sdk( march 2009 ) \i nclude\d3dx9shader.h( 964 ) : error C4430 : missing type specifier - int assumed.Note : C++does not support default - int 1 > c:\p rogram files\microsoft directx sdk( march 2009 ) \i nclude\d3dx9shader.h( 964 ) : error C2086 : 'int DECLSPEC_DEPRECATED' : redefinition 1 > c:\p rogram files\microsoft directx sdk( march 2009 ) \i nclude\d3dx9shader.h( 955 ) : see declaration of 'DECLSPEC_DEPRECATED' 1 > c:\p rogram files\microsoft directx sdk( march 2009 ) \i nclude\d3dx9shader.h( 980 ) : error C2146 : syntax error : missing ';' before identifier 'HRESULT' 1 > c:\p rogram files\microsoft directx sdk( march 2009 ) \i nclude\d3dx9shader.h( 980 ) : error C4430 : missing type specifier - int assumed.Note : C++does not support default - int 1 > c:\p rogram files\microsoft directx sdk( march 2009 ) \i nclude\d3dx9shader.h( 980 ) : error C2086 : 'int DECLSPEC_DEPRECATED' : redefinition 1 > c:\p rogram files\microsoft directx sdk( march 2009 ) \i nclude\d3dx9shader.h( 955 ) : see declaration of 'DECLSPEC_DEPRECATED' 1 > c:\p rogram files\microsoft directx sdk( march 2009 ) \i nclude\d3dx9shader.h( 990 ) : error C2146 : syntax error : missing ';' before identifier 'HRESULT' 1 > c:\p rogram files\microsoft directx sdk( march 2009 ) \i nclude\d3dx9shader.h( 990 ) : error C4430 : missing type specifier - int assumed.Note : C++does not support default - int 1 > c:\p rogram files\microsoft directx sdk( march 2009 ) \i nclude\d3dx9shader.h( 990 ) : error C2086 : 'int DECLSPEC_DEPRECATED' : redefinition 1 > c:\p rogram files\microsoft directx sdk( march 2009 ) \i nclude\d3dx9shader.h( 955 ) : see declaration of 'DECLSPEC_DEPRECATED' 1 > c:\p rogram files\microsoft directx sdk( march 2009 ) \i nclude\d3dx9shader.h( 1007 ) : error C2146 : syntax error : missing ';' before identifier 'HRESULT' 1 > c:\p rogram files\microsoft directx sdk( march 2009 ) \i nclude\d3dx9shader.h( 1007 ) : error C4430 : missing type specifier - int assumed.Note : C++does not support default - int 1 > c:\p rogram files\microsoft directx sdk( march 2009 ) \i nclude\d3dx9shader.h( 1007 ) : error C2086 : 'int DECLSPEC_DEPRECATED' : redefinition 1 > c:\p rogram files\microsoft directx sdk( march 2009 ) \i nclude\d3dx9shader.h( 955 ) : see declaration of 'DECLSPEC_DEPRECATED' 1 > Build log was saved at "file://d:\Pliki\programowanie\kurs directx\lekcja3\lekcja 3\1\Release\BuildLog.htm" 1 > 1 - 59 error( s ) , 6 warning( s ) ========== Build : 0 succeeded , 1 failed , 0 up - to - date , 0 skipped ========== |
|
DejaVu |
» 2009-09-03 17:26:51 Wgrałeś dobrą wersję dx'a? (dla visuala?) |
|
steckel Temat założony przez niniejszego użytkownika |
» 2009-09-03 18:02:24 Wersja DirectX: 9.0 Wersja Visual C++: 9.0 Więc chyba powinno działać. |
|
steckel Temat założony przez niniejszego użytkownika |
» 2009-09-03 18:25:56 Nie wiem, ale zostałem zapytany czy mam dobrą wersję, więc ją podałem, aby ktoś kto się na tym zna mógł to ocenić. |
|
lynx |
» 2009-09-03 20:17:14 Gdy otworzyłem plik projektu z tego kursu poprzez Microsoft Visual C++ 2008 Express Edition to projekt skompilował się bez problemu. Natomiast gdy stworzyłem nowy projekt (windows application) i dodałem do niego main.cpp ze ściągniętego pliku (To był jedyny plik źródłowy) to mi wyskoczyły błędy podobne do tych, które miałem przy Allegro5. Czy jest ktoś w stanie to wyjaśnić? |
A skonfigurowałeś projekt, tak jak trzeba? Po mimo że kompilujesz ten sam kod to tak jak sam widzisz z innymi konfiguracjami projketu. /edit: Znajdź informacje na temat konfiguracji Directx 9.0 pod Visual. To Ci pomoże skonfigurować projekt: http://pccentre.pl/article/show/DirectX_-_oswajamy_potwora/id=17088. |
|
steckel Temat założony przez niniejszego użytkownika |
» 2009-09-03 20:27:17 Ale gdy otworzyłem projekt to działało, a po dodaniu spacji do kodu źródłowego znowu są te błędy. Zobaczę ten link.
//edit
Już tak zrobiłem ;/ |
|
« 1 » 2 |