Reputation: 860
This is related to another namespace issue.
I'm integrating Scaleform into an OSX C++ application.
I'm getting type conflicts between OSX headers (/usr/include/MacTypes.h) and Scaleform Headers:
...other includes... In file included from /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:43: In file included from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:77: /usr/include/MacTypes.h:249:9: error: reference to 'Ptr' is ambiguous typedef Ptr * Handle; ^ /usr/include/MacTypes.h:248:41: note: candidate found by name lookup is 'Ptr' typedef char * Ptr; ^ .../sf_4.6.33_osx_lib/Include/../Src/Kernel/SF_RefCount.h:364:7: note: candidate found by name lookup is 'Scaleform::Ptr' class Ptr ^
I probably don't want to change /usr/include/MacTypes.h :-). And I don't want to go down the path of modifying Scaleform code.
How can I solve this?
Upvotes: 0
Views: 340
Reputation: 11
A workaround is to define your own namespace and put one of the conflicting #include statements in the new namespace. For example, if you determine that including the statement
#include <Carbon/Carbon.h>
in your code leads to the error you've described, then put that statement in a new namespace. For example,
namespace carbon {
#include <Carbon/Carbon.h>
}
You'll then need to preface any references to tokens needing that header with the namespace you've created. For example,
carbon::VoiceSpec v;
carbon::VoiceSpec *vspec = &v;
carbon::OSErr theErr = carbon::noErr;
carbon::SInt16 vindex;
carbon::VoiceDescription vdesc;
Kudos to https://apple-dev.groups.io/g/xcode/topic/76179751 for having tipped me off to the solution.
Upvotes: 0