【问题标题】:Why such OpenAL code gives such Erros in Visual studio 2008?为什么这样的 penAL 代码在 Visual Studio 2008 中会出现这样的错误?
【发布时间】:2010-11-03 15:06:27
【问题描述】:

所以总的来说,我的代码非常简单——我正在尝试编写麦克风回声程序,这就是它的开始(在我看来——我对 OpenAL 很警惕)

#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)" (?BlockingCapture@@YAXPAUALCdevice_struct@@PAEH@Z) HelloOpenALMic.obj HelloOpenALMic

2)Error 2 error LNK2019: ссылка на неразрешенный внешний символ __imp__alcGetIntegerv в функции "void __cdecl BlockingCapture(struct ALCdevice_struct *,unsigned char *,int)" (?BlockingCapture@@YAXPAUALCdevice_struct@@PAEH@Z) 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 作为我的代码的起点。)

如何摆脱它们?

【问题讨论】:

    标签: c++ c visual-studio visual-studio-2008 openal


    【解决方案1】:

    您需要将 OpenAL 库链接到您的应用程序。

    进入项目属性->链接器->输入并将openal32.lib添加到列表中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-07-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多