2010-11-03 60 views
0

所以一般我的代碼是超級簡單 - 我triing寫麥克風回聲PROGRAMM,這是它的開始(因爲在我看來 - 我警惕新的OpenAL)爲什麼這樣的OpenAL代碼在Visual Studio 2008中提供這樣的Erros?

#include "stdafx.h" 
#include <iostream> 
#include <windows.h> 
#include <stdlib.h> 
#include <conio.h> 
#include <math.h> 
#include <stdio.h> 

#include <al.h> 
#include <alc.h> 
#include <alut.h> 


using namespace std; 

int _tmain(int argc, _TCHAR* argv[]) 
{ 
    cin.get(); 
    return 0; 
} 
void BlockingCapture(ALCdevice *mCaptureDevice, ALCubyte *pBuffer, 
        ALCint iSamplesToGet) 
{ 
    ALCint capturedSamples = 0; 
    while(capturedSamples < iSamplesToGet) 
    { 
     ALCint avail; 
     alcGetIntegerv(mCaptureDevice, ALC_CAPTURE_SAMPLES, 1, &avail); 
     if(avail > 0/*or some threshold*/) 
     { 
      avail = min(avail, iSamplesToGet-capturedSamples); 
      alcCaptureSamples(mCaptureDevice, pBuffer, avail); 
      capturedSamples += avail; 
      pBuffer += avail; 
     } 
     else 
      Sleep(0); 
    } 
} 

,當我嘗試編譯它它給了我3個錯誤

1)Error 1 error LNK2019: ссылка на неразрешенный внешний символ __imp__alcCaptureSamples в функции "void __cdecl BlockingCapture(struct ALCdevice_struct *,unsigned char *,int)" ([email protected]@[email protected]@[email protected]) HelloOpenALMic.obj HelloOpenALMic

2)Error 2 error LNK2019: ссылка на неразрешенный внешний символ __imp__alcGetIntegerv в функции "void __cdecl BlockingCapture(struct ALCdevice_struct *,unsigned char *,int)" ([email protected]@[email protected]@[email protected]) HelloOpenALMic.obj HelloOpenALMic

3)Error 3 fatal error LNK1120: 2 неразрешенных внешних элементов C:\Users\Avesta\Documents\Visual Studio 2008\Projects\OJ\OJ\V3\Debug\HelloOpenALMic.exe HelloOpenALMic

順便說一句:(我已將此post作爲我的代碼的起點。)

如何擺脫它們?

回答

1

您需要將OpenAL庫鏈接到您的應用程序。

進入項目屬性 - >鏈接器 - >輸入並將openal32.lib添加到列表中。

相關問題