Reputation: 11
im new to coding in c++, I only programmed in php and Java but I want to learn something more. It may be not the best to start with Audio things but I already know how programming works.
But, I thought to test, get a bit of code from the Apple website and look what happens. I pasted the beginning of the Code in my Project and got errors. And I dont really know what they mean and searching didnt give me any results.
Thats the code:
#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;
}
and those are the errors i get:
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)
thanks for helping me out!
Upvotes: 1
Views: 2881
Reputation: 1461
You'll need to add the AudioUnit
, CoreAudio
and AudioToolbox
frameworks to your project. See this answer for help on how to do that.
You are definitely jumping in the deep end if this is your first experience with C++. Good luck!
Upvotes: 7