Linker can`t find symbols

Hello folks, I am new to Juce and MacOS/iOS and ran into the following problem (IDE is Xcode13): I have made a small audio library with Juce that I want to integrate into an existing application running on MacOS and iOS.

So far so good, I added the Projucer library project as a subproject to my workspace, added the correct header paths, added the subproject as a dependency and linked the library in the build settings of the target, so I can directly test changes I make to the library in the app (for now it is only a small c++ console app for testing since I wanted to find out how to correctly import the library before writing the bridge, as described here: GitHub - adamski/audioengine-demo: An example of a multi-platform library using JUCE).

The problem I am currently running into is the following linker error I cant resolve:

Undefined symbols for architecture arm64:

ld: symbol(s) not found for architecture arm64

This error occurs 101 times, for every juce function that is beeing used. I checked the target architecture settings in both the library and the console app, they are the same. If I change the build active architecture only setting to No, the error changes to

ld: symbol(s) not found for architecture x86_64

I analysed the library binary with the file command in the console, which led to following output:

mylib.a : Mach-O universal binary with 2 architectures: [arm64:current ar archivecurrent ar archive] [x86_64]
mylib.a (for architecture arm64): current ar archive
mylib.a (for architecture x86_64): current ar archive

In my understanding, the binary should support my architecture (arm64), so why cant the linker find the symbols?

Thanks for your help!

In your Projucer project, make sure you added all of the JUCE modules that contain functions used by your library.

In the build log for mylib.a, you should be able to see an entry for each juce module being compiled (juce_core.cpp, juce_audio_basics.cpp etc.):

This is the build log of the project:

It looks for me like the library is built correctly, but the problem is with linking it with the main project. I already followed all the steps of this answer without success. Any advice?

Those aren’t JUCE symbols, those are functions from OS frameworks that JUCE uses (this is why it’s a good idea to include the exact text of any error messages in your questions!).

The frameworks used by JUCE are listed under OSXFrameworks in the module declaration block of each module, which can be found in the module’s header (juce_core.h, juce_audio_basics.h etc.). For example, juce_core depends on Cocoa, Foundation, and IOKit.

In your project, you’ll need to ensure that all of the frameworks that JUCE requires are listed in the “Link Binary With Libraries” build phase, which can be found in the project settings.

Thank you so much, it works now!