简体   繁体   中英

Swift and objective-c name clash when using core graphics

With Xcode 6.1 I'm suddenly getting this error.

/...-Bridging-Header.h:5:2: note: in module 'CoreGraphics' imported from /...-Bridging-Header.h:5:
@import CoreGraphics;
 ^

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGGeometry.h:271:1: error: definition with same mangled name as another definition CGPointMake(CGFloat x, CGFloat y)

It only occurs when I call CGPointMake from my swift class The swift class is using an objective-c class imported in the bridging header that imports core graphics.

I've cleared the module cache and all the derived data and restarted just for good measure. If this isn't an error in the module cache and the core graphics functions are defined in two places i don't know quite how to address it apart from "just don't use that objective-c file" which is what I've done in the mean time to work around it :/

不要在Swift中使用CGPointMake

let point = CGPoint(x: 123, y: 456)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM