Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reference to 'X' is ambiguous

After several changes to my project I suddenly get this build error:

Reference to 'kCGImageAlphaPremultipliedLast' is ambiguous

Reference is ambiguous error screenshot

and when when taking a look at the error it shows me that it is referenced 4 times:

Xcode error screenshot

Can someone please tell me how this can happen and how can I figure out what is causing this? I am not importing anything from CoreGraphics explicitly and my Prefix file only imports ´Foundation.h´ and some self made macros. I am however importing several headers containing pure C code but they are all encapsulated in something like this:

#ifndef __MYCCODE_H
#define __MYCCODE_H
// imports here
// c code here
#endif

This happens in Xcode 5 using LLVM 5.1

Edit: this seems to be a different problem with this project. after commenting this line of code I get another error:

Malformed or corrupted AST file: 'Unable to load module "/Users/xxx/Library/Developer/Xcode/DerivedData/ModuleCache/1NHZ5MC2OSMJV/CoreImage.pcm": module file out of date'

Removing the module and adding it again did not help. Deleting the derived data also didn't help. This error also appears when going back to a working commit.

like image 625
HellGate Avatar asked Aug 19 '14 08:08

HellGate


People also ask

What is ambiguous reference in C++?

Access to a base class member is ambiguous if you use a name or qualified name that does not refer to a unique function or object. The declaration of a member with an ambiguous name in a derived class is not an error. The ambiguity is only flagged as an error if you use the ambiguous member name.

What is ambiguous method?

This ambiguous method call error always comes with method overloading where compiler fails to find out which of the overloaded method should be used. Suppose we have a java program like below. Above program compiles perfectly and when we run it, it prints “String”. So the method foo(String s) was called by the program.

How to solve ambiguous error in c++?

You can resolve ambiguity by qualifying a member with its class name using the scope resolution ( :: ) operator. The statement dptr->j = 10 is ambiguous because the name j appears both in B1 and B2 .


Video Answer


3 Answers

Ok after creating a new Project and coping everything to this project the build was successful however i got this "Malformed or corrupted AST file" error several times again but it can be solved by:

  • Clean the project
  • Deleting everything inside '~/Library/Developer/Xcode/DerivedData/ModuleCache/' (the button inside the organizer window did not work for me)
  • Clean once more
  • Build project

after that it works just fine except that i have to do this fix from time to time

i also did a diff to the old project and it seems a lot of frameworks and other old stuff got stuck in there from testing things so in case you have this check your project settings file for old stuff.

i thought that xcode and me can be friends one day. guess not...

like image 157
HellGate Avatar answered Oct 10 '22 17:10

HellGate


This's maybe you import like this:

#import "xxxx.h"

I fix it through this:

#import < xxxx/xxxx.h>

like image 15
NSKevin Avatar answered Oct 10 '22 16:10

NSKevin


I have got this problem when I have imported a header file twice. After one of them is removed, the problem disappears.

like image 13
Jibeex Avatar answered Oct 10 '22 15:10

Jibeex