Sorry, this is probably a very basic question, but I can't find an answer for it. I am trying to add two modules to a Cocos2d project (@import CoreBluetooth; and @import QuartzCore;). When try to add them to my header file I get an error that says, "Unexpected '@' in program." Are modules not supported in Cocos2d? Do I need to do something to enable them? Am I overlooking something else? Thanks.
Asked
Active
Viewed 288 times
1 Answers
3
Modules are by default enabled in new Xcode projects. For existing projects, go to the "Build Settings" and set "Enable Modules" to YES:
If you set "Link Frameworks Automatically" to YES as well then all imported frameworks are automatically added to the link libraries.
A good overview of the @import
compiler feature is
-
Thanks for the reply Martin. I just created this project in 5.1.1. When I go to "Build Settings" I don't even see this option (I think because it is on by default). The link you posted is one of the questions I read before submitting the question but it didn't solve my problem. – Ryan Tensmeyer May 13 '14 at 19:31
-
@RyanTensmeyer: Make sure that "All" settings are selected, not just "Basic". See screenshot. – Martin R May 13 '14 at 19:45
-
That did the trick. I'm glad (and a little embarrassed) that it was that simple. – Ryan Tensmeyer May 13 '14 at 20:11
-
To clarify, switching the filter from "Basic" to "All" was the solution. – Ryan Tensmeyer May 13 '14 at 20:55