DirectX i VisualStudio problem??

DirectX i VisualStudio problem??

offline
  • Pridružio: 03 Jan 2006
  • Poruke: 37

Pozdrav,pokusavam da ucim DirectX,nabavio sam jednu knjigu,ali ona je za C#,a ja znam C++,
nesto mi je mrsko da ucim sada C#,problem je u tome sto primeri koji idu uz DirectX SDK(2003) nemogu da se
iskompajliraju preko Visual Studio-a 8.Ukljucio sam sve potrebne direktorijume.Nesto nestima Sad
Ovo mi prijavi kao greske :

  1. ------ Build started: Project: CreateDevice, Configuration: Debug Win32 ------
  2. Compiling...
  3. CreateDevice.cpp
  4. c:\program files\microsoft visual studio 8\vc\platformsdk\include\winnt.h(222) : error C2146: syntax error : missing ';' before identifier 'PVOID64'
  5. c:\program files\microsoft visual studio 8\vc\platformsdk\include\winnt.h(222) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
  6. c:\program files\microsoft visual studio 8\vc\platformsdk\include\winnt.h(5940) : error C2146: syntax error : missing ';' before identifier 'Buffer'
  7. c:\program files\microsoft visual studio 8\vc\platformsdk\include\winnt.h(5940) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
  8. c:\program files\microsoft visual studio 8\vc\platformsdk\include\winnt.h(5940) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
  9. Build log was saved at "file://c:\DX90SDK\Samples\C++\Direct3D\Tutorials\Tut01_CreateDevice\Debug\BuildLog.htm"
  10. CreateDevice - 5 error(s), 0 warning(s)
  11. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


Nekontma u cemo je greska Sad
Ima li neko pojma kako da resim problem?
Pozzz



Registruj se da bi učestvovao u diskusiji. Registrovanim korisnicima se NE prikazuju reklame unutar poruka.
offline
  • Pridružio: 18 Apr 2003
  • Poruke: 8134
  • Gde živiš: U kesici gumenih bombona...

Po ovoj gresci, ispada da si zaboravio na nekim mestima da savis semicolon (Wink.
Uradi dupli klik na svaku od ovih gresaka, pogledaj gde te dovede i vidi sta nevalja na toj liniji, prepravi pa tako redom dok ne dodjes do kraja.
Posle kompajliraj i trebalo bi da radi.

Inace, jako je naporno uciti DX iz knjige za C#, a radis u C++.



offline
  • Pridružio: 03 Jan 2006
  • Poruke: 37

Ma znam to za gresku kako da nadjem,nije to,kad dvokliknem na gresku otvori mi winnt.h,a to se ne menja. Smile
zajedno DirectX SDK(2003) dobije se dokumentacija(i gotovi primeri),i za C# i za C++,ali ti gotovi priemri za C++,njih nemogu da iskompajliram dok ove za C# bez problema iskompajliram,ma sigurno je neka glupost,a ja neznam kako da je resim Sad

offline
  • Pridružio: 18 Apr 2003
  • Poruke: 8134
  • Gde živiš: U kesici gumenih bombona...

Hmm. Onda ti ne mogu pomoci.
Ja sam radio nesto malo sa DXom i to za C#, a za C++ nisam dirao.

offline
  • Pridružio: 03 Jan 2006
  • Poruke: 37

Hvala sve jedno,valjda cu naci neko resenje!

offline
  • Pridružio: 18 Apr 2003
  • Poruke: 5001
  • Gde živiš: Beograd

Jedino da uploadujes ono sto zelis da iskompajliras... drugacije ne vidim kako da ti pomognemo. Te greske koje je VS prijavio ocigledno nije ono sto treba da gledas, prekontrolisi taj primer koji pokusavas da uradis, probaj da delove koda stavljas u komentare kako bi izdvojiio sta pravi gresku.

offline
  • Pridružio: 03 Jan 2006
  • Poruke: 37

Primer je iz DX SDK :

  1. //-----------------------------------------------------------------------------
  2. // File: CreateDevice.cpp
  3. //
  4. // Desc: This is the first tutorial for using Direct3D. In this tutorial, all
  5. //       we are doing is creating a Direct3D device and using it to clear the
  6. //       window.
  7. //
  8. // Copyright (c) Microsoft Corporation. All rights reserved.
  9. //-----------------------------------------------------------------------------
  10. #include <d3d9.h>
  11.  
  12.  
  13.  
  14.  
  15. //-----------------------------------------------------------------------------
  16. // Global variables
  17. //-----------------------------------------------------------------------------
  18. LPDIRECT3D9             g_pD3D       = NULL; // Used to create the D3DDevice
  19. LPDIRECT3DDEVICE9       g_pd3dDevice = NULL; // Our rendering device
  20.  
  21.  
  22.  
  23.  
  24. //-----------------------------------------------------------------------------
  25. // Name: InitD3D()
  26. // Desc: Initializes Direct3D
  27. //-----------------------------------------------------------------------------
  28. HRESULT InitD3D( HWND hWnd )
  29. {
  30.     // Create the D3D object, which is needed to create the D3DDevice.
  31.     if( NULL == ( g_pD3D = Direct3DCreate9( D3D_SDK_VERSION ) ) )
  32.         return E_FAIL;
  33.  
  34.     // Set up the structure used to create the D3DDevice. Most parameters are
  35.     // zeroed out. We set Windowed to TRUE, since we want to do D3D in a
  36.     // window, and then set the SwapEffect to "discard", which is the most
  37.     // efficient method of presenting the back buffer to the display.  And
  38.     // we request a back buffer format that matches the current desktop display
  39.     // format.
  40.     D3DPRESENT_PARAMETERS d3dpp;
  41.     ZeroMemory( &d3dpp, sizeof(d3dpp) );
  42.     d3dpp.Windowed = TRUE;
  43.     d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
  44.     d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
  45.  
  46.     // Create the Direct3D device. Here we are using the default adapter (most
  47.     // systems only have one, unless they have multiple graphics hardware cards
  48.     // installed) and requesting the HAL (which is saying we want the hardware
  49.     // device rather than a software one). Software vertex processing is
  50.     // specified since we know it will work on all cards. On cards that support
  51.     // hardware vertex processing, though, we would see a big performance gain
  52.     // by specifying hardware vertex processing.
  53.     if( FAILED( g_pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd,
  54.                                       D3DCREATE_SOFTWARE_VERTEXPROCESSING,
  55.                                       &d3dpp, &g_pd3dDevice ) ) )
  56.     {
  57.         return E_FAIL;
  58.     }
  59.  
  60.     // Device state would normally be set here
  61.  
  62.     return S_OK;
  63. }
  64.  
  65.  
  66.  
  67.  
  68. //-----------------------------------------------------------------------------
  69. // Name: Cleanup()
  70. // Desc: Releases all previously initialized objects
  71. //-----------------------------------------------------------------------------
  72. VOID Cleanup()
  73. {
  74.     if( g_pd3dDevice != NULL)
  75.         g_pd3dDevice->Release();
  76.  
  77.     if( g_pD3D != NULL)
  78.         g_pD3D->Release();
  79. }
  80.  
  81.  
  82.  
  83.  
  84. //-----------------------------------------------------------------------------
  85. // Name: Render()
  86. // Desc: Draws the scene
  87. //-----------------------------------------------------------------------------
  88. VOID Render()
  89. {
  90.     if( NULL == g_pd3dDevice )
  91.         return;
  92.  
  93.     // Clear the backbuffer to a blue color
  94.     g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,255), 1.0f, 0 );
  95.    
  96.     // Begin the scene
  97.     if( SUCCEEDED( g_pd3dDevice->BeginScene() ) )
  98.     {
  99.         // Rendering of scene objects can happen here
  100.    
  101.         // End the scene
  102.         g_pd3dDevice->EndScene();
  103.     }
  104.  
  105.     // Present the backbuffer contents to the display
  106.     g_pd3dDevice->Present( NULL, NULL, NULL, NULL );
  107. }
  108.  
  109.  
  110.  
  111.  
  112. //-----------------------------------------------------------------------------
  113. // Name: MsgProc()
  114. // Desc: The window's message handler
  115. //-----------------------------------------------------------------------------
  116. LRESULT WINAPI MsgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
  117. {
  118.     switch( msg )
  119.     {
  120.         case WM_DESTROY:
  121.             Cleanup();
  122.             PostQuitMessage( 0 );
  123.             return 0;
  124.  
  125.         case WM_PAINT:
  126.             Render();
  127.             ValidateRect( hWnd, NULL );
  128.             return 0;
  129.     }
  130.  
  131.     return DefWindowProc( hWnd, msg, wParam, lParam );
  132. }
  133.  
  134.  
  135.  
  136.  
  137. //-----------------------------------------------------------------------------
  138. // Name: WinMain()
  139. // Desc: The application's entry point
  140. //-----------------------------------------------------------------------------
  141. INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR, INT )
  142. {
  143.     // Register the window class
  144.     WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, MsgProc, 0L, 0L,
  145.                       GetModuleHandle(NULL), NULL, NULL, NULL, NULL,
  146.                       "D3D Tutorial", NULL };
  147.     RegisterClassEx( &wc );
  148.  
  149.     // Create the application's window
  150.     HWND hWnd = CreateWindow( "D3D Tutorial", "D3D Tutorial 01: CreateDevice",
  151.                               WS_OVERLAPPEDWINDOW, 100, 100, 300, 300,
  152.                               GetDesktopWindow(), NULL, wc.hInstance, NULL );
  153.  
  154.     // Initialize Direct3D
  155.     if( SUCCEEDED( InitD3D( hWnd ) ) )
  156.     {
  157.         // Show the window
  158.         ShowWindow( hWnd, SW_SHOWDEFAULT );
  159.         UpdateWindow( hWnd );
  160.  
  161.         // Enter the message loop
  162.         MSG msg;
  163.         while( GetMessage( &msg, NULL, 0, 0 ) )
  164.         {
  165.             TranslateMessage( &msg );
  166.             DispatchMessage( &msg );
  167.         }
  168.     }
  169.  
  170.     UnregisterClass( "D3D Tutorial", wc.hInstance );
  171.     return 0;
  172. }


@Bone Collector
Pokusavao sam,ali bez uspeha,mora biti da je nesto do podesavanja,mozda treba da se ukljuci jos neki lib fajl,.....?
Hvala ,poz

Dopuna: 21 Jul 2006 14:30

Pozz
Problem mi se javi,i samo ako ukjlcim datoteku
#include <d3d9.h> ???
Ima neko pojma ?

offline
  • Pridružio: 06 Avg 2006
  • Poruke: 8

Koju verziju DirectX-a imash na sistemu?

Ko je trenutno na forumu
 

Ukupno su 1116 korisnika na forumu :: 118 registrovanih, 10 sakrivenih i 988 gosta   ::   [ Administrator ] [ Supermoderator ] [ Moderator ] :: Detaljnije

Najviše korisnika na forumu ikad bilo je 3466 - dana 01 Jun 2021 17:07

Korisnici koji su trenutno na forumu:
Korisnici trenutno na forumu: 04bokibole, Abebe Bikila, Andy, Asteker, B61, babaroga, bavar357, Belac91, Betty25, Bivan, Black Luster Soldier, boj.an, bojan_t, Boris90, boro975, ClioP1, cvale, cvrle312, Dannyboy, dearg, DeerHunter, Dejan_vw, Denaya, Desert_Fox, djuradj, Dorcolac, Dovla 1980, dovlafkcz, dukajov, dzada, Feller, g_g, Gall, GAMABL, Gheljda, Gogi_avio, Goksi95, Hans Gajger, havoc995, IQ116, istina, ivan_8282, jalos, Joja, Kajzer_Soze, kib, Koja79, Kruger, Kubovac, kunktator, lukac, Macalone, mane123, Marko Marković, marko.markovic, mauglibn, MB120mm, mean_machine, medaTT, mercedesamg, Miki 24pbr, miki kv, milan47, milenko crazy north, Miletić Zoran, milos.cbr, MountAndBlade, nelezele, niksa517, Nmr, orah, Otto Grunf, Panter, pein, Pikac-47, PlayerOne, pobeda, Posmatrac77OKB, Povratak1912, Prečanin30, Rebel Frank, rednap, Romibrat, ruma, S-lash, S.Palestinac, sixpac, sova72, Srky Boy, StalniPromatrač, Stojan Mrsavi, Strasni JA, synergia, Tafocus, tanakadzo, Tas011, tesic.zeljko, TheBeastOfMG, uruk, Username1000, vathra, Vatreni Zmaj, vedko, vlad4, vladas87, VNVK, voja64, volga.rus20, Vrač, vukajlo71, yiyi, YugoSlav, Zavulon, zivojin32, zlaya011, zombicar153, Zukov, 800077