Is it possible to link Objective-C++ files to the editor?


I'm new to JUCE and don't know wether this topic was encountered before, but I have an objective-C++ class that I would like to link to the audioprocessoreditor (I'm writing an audio plugin), I changed the extention of the latter to ".mm" and it compiled/ran properly under Xcode 5 with the 10.8SDK.

However when I include this exterior objective-c++ header class to the editor i get an overflow of errors in described as "semantic issues" in Finder.h and Component.h which appear to be a part of CarbonCore. (PS: I tried changing the order of which is included first - the objective-c++ class or the JuceHeader, and the same error occurs).


Any help would be much appreciated.


You've not explained what you're doing very clearly, but it sounds like you're trying to include your obj-C code in a .cpp file, which obviously ain't gonna fly.

No that's not really it,


I changed the plugineditor extention to ".mm" aswell. And it compiles fine and runs fine with the ".mm" extention but as soon as I include the other objective-C header file to the plugin editor, I get the errors,

I attached a picture of the errors I'm getting aswell.


The code that I'm trying to include in the process editor is an AVFoundation stillImage class (A class that takes images using AVFoundation) I'm trying to incorporate that within an audio-plugin you see.


Again thanks for the trouble.

Well, maybe Xcode is still treating the file as C++ rather than obj-C/C++. I think there's a setting for that somewhere.

XCode is treating the new ".mm" editor as a objective-c++ file.


I tried just linking the <AVFoundation/AVfountation.h> to the editor and I got the same semantic problems. I think the juceheader.h and the AVFoundation Kit don't mix properly. Maybe a matter of redefinitions ect...

Oh well :-(


Are you including your Obj-C code within a namespace? You'll see these kinds of errors if you do. You may also end up including Obj-C code in a normal C++ file by accident (e.g. does anything else include your plugineditor.h file?).

When I've had to do this sort of thing before I've used a completely C++ header and made any Obj-C a pimpl within the .mm file. It does sometimes involve a lot of void* passing of objects around over the C++ layer but seems to work ok.

Take a look at some of the iOS classes here for an example: There may be other ways around it but this is the simplest way I've found.

Our project has a lot of straight c++ and some mixed Objective C. What we do is go into the project settings and tell the compiler to treat everything as Objective C++ instead of by extension. This solved these kinds of errors for our project.