2013-02-05 19 views
0

我们开发了一个自定义音频单元和音频单元托管应用程序。我们正试图从应用程序动态注册自定义音频单元。 下面的代码片段用于注册音频单元动作。虽然编辑音频单元宿主应用程序(此代码段是在苹果公司的技术说明技术说明TN2247提到)音频单元动态注册

#include <AudioUnit/AudioComponent.h> 
extern AudioComponentPlugInInterface* 
       MyExampleAUFactoryFunction(const AudioComponentDescription *inDesc); 

OSStatus RegisterMyExampleAudioUnit() 
{ 
    // fill out the version number for the AU 
    UInt32 theVersion = 0x00010000; 

    // fill out the AudioComponentDescription 
    AudioComponentDescription theDescription; 
    theDescription.componentType = kAudioUnitType_Effect; 
    theDescription.componentSubType = 'EXAU'; 
    theDescription.componentManufacturer = 'MYCO'; 
    theDescription.componentFlagsMask = 0; 

    // Use the flag to indicate that this AudioComponent is Sandbox Safe 
    theDescription.componentFlags = kAudioComponentFlag_SandboxSafe; 

    // call AudioComponentRegister() 
    return AudioComponentRegister(&theDescription, CFSTR("My Company: MyExampleAU"), 
          theVersion, MyExampleAUFactoryFunction); 

,我们得到以下链接器错误。对于i386硬件架构

未定义的符号:
“_MyExampleAUFactoryFunction”,从引用:

任何一个可以帮我解决这个问题。

+0

这是在.c或.cpp文件中? – sbooth

+0

它在.m文件中 – SPrabhu

+0

定义了“MyExampleAUFactoryFunction”的位置? – sbooth

回答

0

我也遇到过这个问题,我的项目只有C和Objective-C代码。 它帮助创建一个单独的cpp类并将其添加到项目中。我不知道链接器内部的更深层原因是什么。