[DX/C++] linker error op IID *

Pagina: 1
Acties:
  • 92 views sinds 30-01-2008

  • DieterVDW
  • Registratie: Juli 2002
  • Laatst online: 12-02-2017
Het onderstaande stukje code heb ik gepikt vanuit de DirectX API,
onderdeeltje 'Creating Secondary Buffers'.
Dit stukje code creert een secondary buffer en geeft een IDirectSoundBuffer8 interface terug.
Ik begrijp niet dat dit niet compiled, aangezien het letterlijk overgenomen is van een example uit de DX API.

Ik krijg de volgende error:
code:
1
2
3
4
Linking...
SimplePlayer.obj : error LNK2001: unresolved external symbol _IID_IDirectSoundBuffer8
Debug/SimplePlayer.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.


dsound.h is geincluded en dsound.lib is aan het project toegevoegd.
Wat is er mis?

edit: Sorry topictitel vergeten!!!

Code:
C++:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
HRESULT CreateBasicBuffer(LPDIRECTSOUND8 lpDirectSound, LPDIRECTSOUNDBUFFER8* ppDsb8) 
{ 
    WAVEFORMATEX wfx; 
    DSBUFFERDESC dsbdesc; 
    LPDIRECTSOUNDBUFFER pDsb = NULL;
    HRESULT hr; 
    
    // Set up WAV format structure. 
    
    memset(&wfx, 0, sizeof(WAVEFORMATEX)); 
    wfx.wFormatTag = WAVE_FORMAT_PCM; 
    wfx.nChannels = 2; 
    wfx.nSamplesPerSec = 44100; 
    wfx.nBlockAlign = 4; 
    wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign; 
    wfx.wBitsPerSample = 16; 
    
    // Set up DSBUFFERDESC structure. 
    
    memset(&dsbdesc, 0, sizeof(DSBUFFERDESC)); 
    dsbdesc.dwSize = sizeof(DSBUFFERDESC); 
    dsbdesc.dwFlags = 
        DSBCAPS_CTRLPAN | DSBCAPS_CTRLVOLUME | DSBCAPS_CTRLFREQUENCY; 
    dsbdesc.dwBufferBytes = 3 * wfx.nAvgBytesPerSec; 
    dsbdesc.lpwfxFormat = &wfx; 
    
    // Create buffer. 
    
    hr = lpDirectSound->CreateSoundBuffer(&dsbdesc, &pDsb, NULL); 
    if (SUCCEEDED(hr)) 
    { 
        hr = pDsb->QueryInterface( IID_IDirectSoundBuffer8, (LPVOID*) ppDsb8);
        pDsb->Release();
    } 
    return hr;
} 

[ Voor 3% gewijzigd door DieterVDW op 02-09-2003 16:16 . Reden: Titel :( ]


  • whoami
  • Registratie: December 2000
  • Laatst online: 22:54
Het compiled wel, maar het linked niet.

https://fgheysels.github.io/


  • curry684
  • Registratie: Juni 2000
  • Laatst online: 13-08 16:46

curry684

left part of the evil twins

Je bent dxguid.lib vergeten mee te linken. Staat in de handleiding op MSDN Library.

Professionele website nodig?


Dit topic is gesloten.