iPhone Linker Error (AudioStreamer)

2019-08-12 02:54发布

问题:

I'm using Matt Gallagher's Audio Streaming Project. I downloaded the code/project and it runs/compiles/links just fine.

The problem is when I try to integrate the AudioStreamer class into my own project. I added all the necessary frameworks and checked over the project settings to make sure they match Matt's project as much as possible.

I haven't added any of Matt's code yet (except for the AudioStreamer class). All I'm doing for now is defining this function:

- (void)createStreamer {
    streamer = [[AudioStreamer alloc] initWithURL:audiourl];
}

If I comment out the only line in that function the project compiles/links fine. If I leave that line there I get this error (which if I understand correctly is a linker error):

"_OBJC_CLASS_$_AudioStreamer", referenced from:
objc-class-ref-to-AudioStreamer in AudioViewController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

I googled this error and most people get it because they forgot to include a certain framework. I have all the frameworks I need in my project.

Does anyone know any other reason why this error could occur? Is there some setting that I may be overlooking?

Most of the project settings are the same except for the build architecture being set to arm6,arm7 in Matt's project and i386 on mine. I tried compiling for both simulator and device and I get the same error.

The only thing I could think of is that Matt's project is dated 2009 (pretty old) so maybe something changed in the default configuration in the new xcodes?

If anyone can provide any insight I'd appreciate it.

Thanks.

回答1:

It sounds like you need to add AudioStreamer.m to your target.