Linker flags for one library break loading of another
I'm trying to use FMOD and HTTPriot in the same app. FMOD works fine until I add in linker flags for HTTPriot, at which point I get a bunch of linking errors wherein FMOD is complaining about undefined symbols. In other words, adding in linker flags for HTTPriot seems to break the loading of FMOD's library.
These are the kinds of errors I'm getting, all coming during the linking phase of my build:
Undefined symbols:
"_FMOD_Sound_Lock", referenced from:
-[FMODEngine recordedSoundAsNSData] in FMODEngine.o
-[FMODEngine writeRecordingToDiskWithName:] in FMODEngine.o
"_FMOD_MusicSystem_PrepareCue", referenced from:
-[FMODEngine addCue:] in FMODEngine开发者_C百科.o
These are the linker flags for HTTPriot: -lhttpriot -lxml2 -ObjC -all_load
I added those as well as a path to the HTTPriot SDK per the instructions here: http://labratrevenge.com/httpriot/docs/iphone-setup.html
I was hoping someone could enlighten me on why adding linker flags for one library might cause a failure of another to load. If I DON'T have these flags in, HTTPriot and FMOD both work fine on the simulator, but HTTPriot has runtime errors on the device, I assume because its libraries are not linked. FMOD works fine on the device though.
I placed header search paths and library search paths in my build settings in order for XCode to find FMOD. That seemed to be OK until I tried adding these HTTPriot linker flags. I also tried adding a linker flag for the FMOD library (-lfmodex), but I get the same errors as I do without it.
Yeah - for anyone else that hits this problem, the part in the HTTPRiot instructions where it says:
Set the Other Linker Flags to -lhttpriot -lxml2 -ObjC -all_load
Be very wary of that part. For me that field was empty, so I simply had to set "Other Linker Flags" to -lhttpriot only.
Otherwise it appears XCode is re-importing things your not asposed-to causing duplication issues :)
This was just an issue of accidentally overwriting the linker flags setting. It's easy to do in XCode by accident.
精彩评论