Hello folks. I have a dumb question on compiling CocosDenshion
(latest code checked out from subversion just a few minutes ago... not
sure if there is a more stable version available). This is the first
time I've tried doing this, but I can't seem to get past some linker
errors. I tried Fraggle's trick from
http://fraggle.squarespace.com/blog/2009/5/11/iphone-sdk-gotchas-1.html , but no luck. Here are the linker errors:
"_AudioSessionSetProperty", referenced from:
-[CDAudioManager audioSessionResumed] in CDAudioManager.o
-[CDAudioManager
init:channelGroupDefinitions:channelGroupTotal:] in CDAudioManager.o
-[CDSoundEngine audioSessionResumed] in CocosDenshion.o
-[CDSoundEngine init:channelGroupTotal:audioSessionCategory:] in
CocosDenshion.o
"_ExtAudioFileSetProperty", referenced from:
MyGetOpenALAudioData(__CFURL const*, int*, int*, int*)in
CocosDenshion.o
"_AudioSessionGetProperty", referenced from:
-[CDAudioManager
init:channelGroupDefinitions:channelGroupTotal:] in CDAudioManager.o
"_AudioSessionSetActive", referenced from:
-[CDAudioManager audioSessionResumed] in CDAudioManager.o
-[CDAudioManager audioSessionInterrupted] in CDAudioManager.o
-[CDSoundEngine audioSessionResumed] in CocosDenshion.o
-[CDSoundEngine audioSessionInterrupted] in CocosDenshion.o
"_ExtAudioFileGetProperty", referenced from:
MyGetOpenALAudioData(__CFURL const*, int*, int*, int*)in
CocosDenshion.o
MyGetOpenALAudioData(__CFURL const*, int*, int*, int*)in
CocosDenshion.o
".objc_class_name_AVAudioPlayer", referenced from:
literal-pointer@__OBJC@__cls_refs@AVAudioPlayer in
CDAudioManager.o
"_AudioSessionInitialize", referenced from:
-[CDAudioManager
init:channelGroupDefinitions:channelGroupTotal:] in CDAudioManager.o
-[CDSoundEngine init:channelGroupTotal:audioSessionCategory:] in
CocosDenshion.o
"_ExtAudioFileRead", referenced from:
MyGetOpenALAudioData(__CFURL const*, int*, int*, int*)in
CocosDenshion.o
"_ExtAudioFileOpenURL", referenced from:
MyGetOpenALAudioData(__CFURL const*, int*, int*, int*)in
CocosDenshion.o
"_ExtAudioFileDispose", referenced from:
MyGetOpenALAudioData(__CFURL const*, int*, int*, int*)in
CocosDenshion.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Maybe the iPhone library for OpenAL is in a different spot, and I'm
not setting up the "Framework Search Paths" property correctly (right
now, I have it at $SDKROOT/System/Library/Frameworks with recursive
checked, where $SDKROOT seems to resolve to iphoneos2.2.1). Any help
would be appreciated.
I believe I had the same linking errors you had until I added the
required frameworks, Steve mentioned all the ones in his reply. One
thing you may notice is that some of the frameworks may not show up in
the framework list when you try to add them (i couldn't find
AVFoundation in the frameworks folder). I had to manually find the
required frameworks from finder and add from a different location.
I'm not really sure why my 2.2.1 install was missing several
frameworks.
I copied the denshion library sources into my project, without the
demo folder. After reading your post, I included the frameworks for
AudioToolbox, CoreAudio, and AVFoundation along with OpenAL, but no
luck. I'm still getting linker errors, this time prefixed with _al.
All the frameworks were imported directly by finding them in the
iphoneos3.0 SDK folder. I'm at work now... I'll post more details
when I get home.
On Jun 3, 11:05 pm, allenfjordan <allen.jor...@gmail.com> wrote:
> I copied the denshion library sources into my project, without the
> demo folder.
Can you please try building the CocosDenshion demo project that is
shipped with cocos2d. Then we can determine whether it is a problem
with your project or your environment.
If it is your environment then it would be useful to know if you have
problems with any other OpenAL apps like oalTouch or the Aeterius
sound engine.
I finally managed to build the library without any linker errors. I'm
not sure exactly what fixed it, but here are the main steps I took:
1. Under the general options, I changed "Base SDK for All
Configurations" to iPhone Device 3.0
2. Under the build options, set to "All Configurations", I changed
"Framework Search Paths" by adding "$SDKROOT/System/Library/
Frameworks/"
3. Now that the frameworks were being properly referenced from the
iphoneos3.0 platform directory, I added the following frameworks to my
project (through the "Link Binary With Libraries" section under
Targets):
a. OpenAL
b. CoreAudio
c. AVFoundation
d. AudioToolbox
4. I was still getting linker errors until I deleted existing
frameworks that I had accidentally copied to my main project directory
through earlier escapades.
Now my project compiles cleanly. Thanks for all the help... I'll try
compiling the CocosDenshion demo later, just to see if it works.
I tried playing a simple sound effect in my game, and it seems to work
perfectly :) . One very small annoyance is the loading time when
initializing CDAudioManager (seems to be about 1 second on my iPod
Touch 2nd gen, longer on the simulator), but I'll try to do this when
the game is first starting rather than when loading the main game
after menu selection. Thanks for making this great engine, Steve.
Hopefully I can put it to good use.