none
智能设备DLL的LNK2019问题 RRS feed

  • 问题

  • 我现在做g。729编解码的c++智能设备DLL代码如下:

    头文件:
    extern "C" void va_g729a_init_encoder();
    extern "C" void va_g729a_encoder(short *speech, unsigned char *bitstream);
    extern "C" void va_g729a_init_decoder();
    extern "C" void va_g729a_decoder(unsigned char *bitstream, short *synth_short, int bfi);
     
    源文件:
     #include "stdafx.h"
    #include "g729a.h"
    #pragma comment(lib,"G729a.lib")//这里包括了729编解码的库,我也把它拷到工程目录下了
    #ifdef _DEBUG
    #define new DEBUG_NEW
    #endif
    #define SIZE_AUDIO_FRAME 960
    #define SIZE_AUDIO_PACKED 60


    bool __declspec(dllexport) EncodeAudioData(char *pin,int len,char* pout,int* lenr)
    {
     BOOL bRet=FALSE;
     if(!pin||len!=SIZE_AUDIO_FRAME||!pout)
      goto RET;
     
     va_g729a_encoder((short*)pin,(BYTE*)pout);
     va_g729a_encoder((short*)(pin+160),(BYTE*)pout+10);
     va_g729a_encoder((short*)(pin+320),(BYTE*)pout+20);
     va_g729a_encoder((short*)(pin+480),(BYTE*)pout+30);
     va_g729a_encoder((short*)(pin+640),(BYTE*)pout+40);
     va_g729a_encoder((short*)(pin+800),(BYTE*)pout+50);
     if(lenr)
      *lenr=SIZE_AUDIO_PACKED;
     bRet=TRUE;
    RET:
     return bRet;
    }
    bool __declspec(dllexport) DecodeAudioData(char *pin,int len,char* pout,int* lenr)
    {
     BOOL bRet=FALSE;
     if(!pin||len!=SIZE_AUDIO_PACKED||!pout)
      goto RET;
     va_g729a_decoder((BYTE*)pin,(short*)(pout),0);
     va_g729a_decoder((BYTE*)pin+10,(short*)(pout+160),0);
     va_g729a_decoder((BYTE*)pin+20,(short*)(pout+320),0);
     va_g729a_decoder((BYTE*)pin+30,(short*)(pout+480),0);
     va_g729a_decoder((BYTE*)pin+40,(short*)(pout+640),0);
     va_g729a_decoder((BYTE*)pin+50,(short*)(pout+800),0);
     if(lenr)
      *lenr=SIZE_AUDIO_FRAME;
     
     bRet=TRUE;
    RET:
     return bRet;
    }
     此外我在项目属性-》链接-》输入栏里填写入了G729a.lib,可是一编译就提示“错误 2 error LNK2019: 无法解析的外部符号 va_g729a_encoder,该符号在函数 "bool __cdecl EncodeAudioData(char *,int,char *,int *)" (?EncodeAudioData@@YA_NPADH0PAH@Z) 中被引用 g.729.obj ”
    请问大家怎么解决啊?
    2008年5月4日 7:22

全部回复