The "Component is ambiguous" error comes in JUCE 2.0


#1

I’m trying to use JUCE 2.0 in my project in which I used JUCE v1.5X.
Juce 2.0 is very good but I had to tweak lots of stuff :slight_smile: … and I could not complete to build it yet because of the “Component is ambiguous” error :frowning:
I know I can escape from this error by including Carbon header before including juce headers. So I’m used to insert Carbon in my precompiled header. But this does not work with JUCE 2.0…

Well guys, do you have this kind of troubles when updating your project to JUCE 2.0??

For example, I cannot even compile JuceDemo when inserting this kind of line:

 CFStringRef pCFStrUserName = CSCopyUserName(true);

I don’t know where I should include <Carbon/Carbon.h>…


#2

You really should drop carbon - Apple have deprecated it, you won’t be able to use it in 64-bit builds or on the next release of OSX. And there’s certainly no reason to use old functions like CSCopyUserName, you should use cocoa functions instead, or SystemStats::getFullUserName().

But if you search the codebase for places where I’ve included carbon.h, you’ll see some tricks you can copy to make it work.


#3

Hi Jules,

Thanks, I could build my project by CarbonDummyComponentName tricks.
But you’re right, I have to migrate my proj from Carbon to Cocoa…