Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 964 Vote(s) - 3.47 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Swift beta 6 - Confusing linker error message

#1
I'm getting an error message from the linker when building a Swift program with Xcode 6 beta 6, targeting iOS 8. This code compiled and ran correctly with beta 5.

Undefined symbol for architecture x86_64:
__TFSs26_forceBridgeFromObjectiveCU__FTPSs9AnyObject_MQ__Q_", referenced from:
__TFC8RayTrace14RayTracingPlot15drawFocalPointfS0_FT_T_ in RayTracingPlot.o
ld: symbol(s) not found for architecture x86_64

Here's the code in question:

private func drawFocalPoint() {
var attributes = Dictionary<String, AnyObject>()

let FString: String = "F"
let distance: CGFloat = focalDistance

let centerX = CGRectGetMidX(bounds)
let centerY = CGRectGetMidY(bounds)

let circleRadius: CGFloat = 4.0
let focalPointFrame = CGRectMake(0, 0, circleRadius * 2.0, circleRadius * 2.0)
var path = UIBezierPath(ovalInRect: focalPointFrame)
let color = UIColor.blackColor()

let currentContext = UIGraphicsGetCurrentContext()
CGContextSaveGState(currentContext)
let shadowColor = UIColor(white:0, alpha:0.75).CGColor
CGContextSetShadowWithColor(currentContext, CGSizeMake(0, 4), CGFloat(8), shadowColor)

// Image F
var imageFPath = UIBezierPath(CGPath: path.CGPath)
let imageFTransform = CGAffineTransformMakeTranslation((centerX - distance - circleRadius),
(centerY - circleRadius))
imageFPath.applyTransform(imageFTransform)
color.set()
imageFPath.fill()
FString.drawAtPoint(CGPointMake(centerX - distance - circleRadius, centerY + 5), withAttributes:attributes)

CGContextSetShadowWithColor(currentContext, CGSizeMake(0.0, 0.0), CGFloat(0.0), nil) // Clear shadow
CGContextRestoreGState(currentContext)
}

I'd appreciate a hint about where in this code to look for the error so I can fix it. Thank you.
Reply

#2
For other people that might stumble on this error. I have had this when implementing `CocoaPods` and not setting my target's `Other Linker Flags` to `$(inherited)`
Reply

#3
Another cause of this error (seen with Xcode 6.1.1, and Xcode 6.2 Beta 3), is having an enum with only one case in one class, and declaring a variable of that type in a second class.

This code will cause a linker error:

class ClassA {
enum ExampleEnum {
case Option1
}
}

class ClassB {
var example: ClassA.ExampleEnum = .Option1
}

This will fix it.

class ClassA {
enum ExampleEnum {
case Option1
case Option2 // Added a second case
}
}

class ClassB {
var example: ClassA.ExampleEnum = .Option1
}

Radar for more info and a sample project:

[To see links please register here]


An enum with only one case is pretty useless in practice and so the compiler is probably optimizing it away or something. I hit this when setting up a new project, using an enum for achievements to be determined later, and had just 1 placeholder.

Also note: Use Watchdog

[To see links please register here]

to avoid having to worry about Derived Data issues.
Reply

#4
I got this error even with the new version of Beta6 that was release hours after the bad one got pulled.

I've solved this and other similarly illegible errors by deleting the contents of the Derived folder. You can find where that folder is located by going to Preferences > Locations.

The default path is:
/Users/[your username]/Library/Developer/Xcode/DerivedData

You can also hold `Option` while the Product menu is open in Xcode, which will change `Clean` to `Clean Build Folder`... and accomplish the same task without having to folder-hunt.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through