Reference to 'X' is ambiguous

2019-01-18 02:22发布

After several changes to my project i suddenly get the build error:

Reference to 'kCGImageAlphaPremultipliedLast' is ambiguous

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

enter image description here

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 did also not help. this error also appears when going back to a working commit

8条回答
Melony?
2楼-- · 2019-01-18 02:42

Remove use_frameworks! from pod file fix my ambiguous problem.

查看更多
Juvenile、少年°
3楼-- · 2019-01-18 02:48

This's maybe you import like this:

#import "xxxx.h"

I fix it through this:

#import < xxxx/xxxx.h>

查看更多
【Aperson】
4楼-- · 2019-01-18 02:48

For anyone still struggling with issue: Non of the of the proposed solutions worked in my case. I'm compiling all my frameworks using Carthage and was getting these errors in my main project whenever I import a header of a framework that's using a framework used also by my main project. What eventually solved it was disabling 'Modules' on the main project. enter image description here

查看更多
Evening l夕情丶
5楼-- · 2019-01-18 02:51

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...

查看更多
你好瞎i
6楼-- · 2019-01-18 02:54

use

#import "anyviewcontroller.h"

instead of any module

@import anymodule;

I am using LGSideMenuController, when i integrate it first time, it is working well, but i don't know why i got this error after some time.

so i replaced module @import LGSideMenuController; into header file Like this #import "UIViewController+LGSideMenuController.h"

and error goes away.

查看更多
对你真心纯属浪费
7楼-- · 2019-01-18 03:03

I just had the same warnings littering up my build report (but only under the triangle). In the end what worked for me was to insure that EVERY usage of:

#import <Module/Module.h> 

in the app was replaced by:

@import Module;

Now all those annoying warnings are gone!

查看更多
登录 后发表回答