ebiten: "unexpected '@' in program" running examples on macOS
On macOS 10.11.6 (El Capitan), with the latest ebiten from the master branch:
~/go/src/github.com/hajimehoshi/ebiten/examples/sprites [master|✔]
14:18 $ go run main.go
# github.com/hajimehoshi/ebiten/internal/graphicsdriver/metal/ca
ca.m:49:7: error: unexpected '@' in program
ca.m:54:13: warning: instance method '-setMaximumDrawableCount:' not found (return type defaults to 'id') [-Wobjc-method-access]
/System/Library/Frameworks/QuartzCore.framework/Headers/CAMetalLayer.h:44:12: note: receiver is instance of class declared here
ca.m:65:7: error: unexpected '@' in program
ca.m:68:37: warning: instance method '-setDisplaySyncEnabled:' not found (return type defaults to 'id') [-Wobjc-method-access]
/System/Library/Frameworks/QuartzCore.framework/Headers/CAMetalLayer.h:44:12: note: receiver is instance of class declared here
Not sure if this is a bug with ebiten, or if I’m just on too old a version of macOS now you’re using Metal for rendering.
Works fine with latest release (v1.8.1).
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 23 (11 by maintainers)
Commits related to this issue
- graphicsdriver/metal: Avoid using @available syntax for old Xcode (#781) — committed to hajimehoshi/ebiten by hajimehoshi 5 years ago
- graphicscommand: Use GL on macOS 10.11 or older (#781) — committed to hajimehoshi/ebiten by hajimehoshi 5 years ago
Yeees! It would be impossible to remove all the warning, but I think that’s acceptable.
Thank you for cooperation!
Yep. Confirmed that this does work 😃
We do still get the warnings as before, but thats less important than the main thing, which is that it works 🎉
Thank you for confirming!
Fixed to use OpenGL when macOS is 10.11 or older. (We have already confirmed that Metal worked on macOS 10.12 or newer).
Hmm, ok.
The cause is the usages of
@available
syntax.https://developer.apple.com/documentation/swift/objective-c_and_c_code_customization/marking_api_availability_in_objective-c
I’m thinking to avoid this by macro. Please stay tuned (it’s also ok if you want to update macOS or Xcode now).