Thanks to the Projucer, I created this very basic project, just to understand how to generate a static library for iOS and how to import it on an iOS project (it’s a screenshot made with Android Studio, but I actually built it with Xcode 13.2.1):
I managed to generate the library and locate the .a
file. By running lipo -info libJuceDemo.a
, I can see that it’s a fat file, targeting the arm64
and the armv7
architectures (that being said, I got sometimes that it’s a non fat file, only targeting arm64
, I still don’t understand why…).
Now I’m trying to import it on an iOS project, and here is what I did:
-
I created a
CPP
group, then aJuce
group, and copied thelibJuceDemo.a
,AppConfig.h
,JuceHeader.h
andJuceTest.h
files in it, as you can see here:
-
If I go to
Runner > Targets > General > Frameworks, Libraries, and Embedded Content
, I can see thatlibJuceDemo.a
is here, as expected -
Then I went to
Runner > Project > Build Settings > Search Paths
, and forHeader Search Paths
, I added:$SRCROOT/Runner/CPP/Juce
(I tried both recursive and non recursive)
Then I tried to call the code of the library from my C++ code of my iOS app:
- I added:
#include "Juce/JuceTest.h"
- I instantiate the
JuceTest
class as the following:jucetest::JuceTest juceTest;
Now when I try to compile and run my iOS app, I get the following error:
error: unknown type name 'JuceTest'
One more thing: If I go to Runner > Targets > Build Phases > Dependencies
and click the +
button, I can’t find neither my library nor any of its header file…
Did I miss something?
Thanks for your help.