2013-04-08 10 views
0

im for C++ 코딩에 익숙하지 않았습니다. PHP와 Java로만 프로그래밍되었지만 더 많은 것을 배우고 싶습니다. Audio로 시작하는 것이 최선의 방법은 아니지만 프로그래밍 방식이 무엇인지 이미 알고 있습니다.Xcode Audiocomponent Symbol을 찾지 못했지만 어떻게 든 사용하지 못하는 방법

그러나 나는 애플 웹 사이트에서 약간의 코드를 시험해보고 어떻게 될지 생각했습니다. 프로젝트의 코드 시작 부분을 붙여 오류가 발생했습니다. 그리고 나는 그들이 의미하는 바를 잘 알지 못했고 검색 결과가 나에게 어떤 결과도주지 못했습니다.

코드 그게

:

#include <iostream> 
#include <CoreAudio/CoreAudio.h> 
#include <AudioToolbox/AudioToolbox.h> 
#include <AudioUnit/AudioUnit.h> 

int main(int argc, const char * argv[]) { 
    // insert code here... 
    AudioComponent comp; 
    AudioComponentDescription desc; 
    AudioComponentInstance auHAL; 
    //There are several different types of Audio Units. 
    //Some audio units serve as Outputs, Mixers, or DSP 
    //units. See AUComponent.h for listing 
    desc.componentType = kAudioUnitType_Output; 
    //Every Component has a subType, which will give a clearer picture 
    //of what this components function will be. 
    desc.componentSubType = kAudioUnitSubType_HALOutput; 
    //all Audio Units in AUComponent.h must use 
    //"kAudioUnitManufacturer_Apple" as the Manufacturer 
    desc.componentManufacturer = kAudioUnitManufacturer_Apple; 
    desc.componentFlags = 0; 
    desc.componentFlagsMask = 0; 
    //Finds a component that meets the desc spec's 
    comp = AudioComponentFindNext(NULL, & desc); 
    if (comp == NULL) exit(-1); 
    //gains access to the services provided by the component 
    AudioComponentInstanceNew(comp, & auHAL); 
    return 0; 
} 

을하고 사람들은 내가 얻을 오류입니다 : 저를 도와 주셔서

Undefined symbols for architecture x86_64: 
"_AudioComponentFindNext", referenced from: 
    _main in main.o 
"_AudioComponentInstanceNew", referenced from: 
    _main in main.o 
ld: symbol(s) not found for architecture x86_64 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 

감사합니다!

답변

4

프로젝트에 AudioUnit, CoreAudioAudioToolbox 프레임 워크를 추가해야합니다. 이를 수행하는 방법에 대한 도움말은 this answer을 참조하십시오.

C++에 대한 첫 경험이 있다면 분명히 심오한 부분에 뛰어들 것입니다. 행운을 빕니다!

관련 문제