Using an Obj-C Framework in a C++ JUCE Application project?


I’m currently developing an App based on JUCE, but i need to use a Framework of which i only have an Objective-C version.

Trying to include the headers directly, i get lots of errors of the type:

Unknown type name 'NSString'; did you mean 'String'?

There seems to be some resources regarding using C++ in Obj-C projects, but not the other
way round … what am i missing here ?



You should use the file suffix .mm rather than .cpp then the compiler will compile with Objective-C++


Doesn’t seem to be as simple as that, as now i get errors in the fashion of:

Finder.h:261:3: Reference to 'Point' is ambiguous


Hmm ok, in general compiling the App as Obj-C++ works, but there seems to be a namespace conflict or something with JUCE and the Framework …

Thanks for the hint, btw :slight_smile:


Always include your libraries headers before the juce headers


Yes, that does the trick, mostly … plus, you need to explicitly specify the namespace on

juce::Component* createMainContentComponent()     { return new MainContentComponent();}

Otherwise, there’ll still be a conflict regarding the Component* pointer