Hi.
I have trouble linking an application against a static library in xcode. The static library is created with the introducer and uses some juce functions internally. I've created a small test library and it has the same problems. Here's what I did:
1. created a static library project with juce. It just has one function:
#include "test.h" #include "juceHeader.h" const char * testfunction() { juce::String test("test"); return test.toRawUTF8(); }
2. compiled the library without errors.
3. created a project for a console application in xcode. In build phases I added my library to "link binary with libraries". It shows up in the project and the path is added to the search path.
4. Added some code to test:
#include <iostream> extern const char * testfunction(); int main(int argc, const char * argv[]) { std::cout << testfunction() << std::endl; std::cin.get(); return 0; }
5. When compiling this, i get:
Undefined symbols for architecture x86_64:
"_CFArrayGetValueAtIndex", referenced from:
juce::SystemStats::getDisplayLanguage() in libNewProject.a(juce_core.o)
"_CFLocaleCopyCurrent", referenced from:
juce::SystemStats::getUserLanguage() in libNewProject.a(juce_core.o)
juce::SystemStats::getUserRegion() in libNewProject.a(juce_core.o)
"_CFLocaleCopyPreferredLanguages", referenced from:
juce::SystemStats::getDisplayLanguage() in libNewProject.a(juce_core.o)
... and a lot more of those. Compiling libraries for windows and android works just fine. I'm not a frequent mac user though. Maybe I'm missing something? (I did check that the library as well as the test app are compiled for x86_64. ) I also verified with:
nm -gU libNewProject.a | grep 'getDisplayLanguage'
and the library has this symbol:
000000000005f020 T __ZN4juce11SystemStats18getDisplayLanguageEv
Any help on this would be great. I'm completely clueless about what is wrong.