While it’s not my favorite environment, it’s certainly possible to use Nu from within Xcode. That’s especially useful for platforms that have undocumented dependencies on Xcode. Here are some tips.
Be sure to use TextMate as your text editor so that you can use nubile to keep your code in shape. (Later I’ll describe how you can use nubile in Xcode).
Here are some important build settings; in this case for using Nu built as a static library (libNu.a):| Header search paths: | ../../NuSDK/include |
| Other C Flags: | -std=gnu99 |
| Other Linker Flags: | -ObjC -ledit -lffi -lNu -lpcre -L../../NuSDK/lib |
The -ObjC linker flag is especially important if you are linking static libraries that contain Objective-C classes. Without it, the classes won’t get linked into your executable.
Nu source files (such as main.nu) must be included in the Copy Bundle Resources build stage. To find that, open the target in the Groups & Files pane. Then drag your Nu source file down from the Resources folder (or wherever you’ve put it), and drop it on the Copy Bundle Resources item.
If you’re on a platform that doesn’t include BridgeSupport, you’ll have to manually bridge any C functions you want to call. Here’s how to do it for NSLog:
(set NSLog (NuBridgedFunction functionWithName:"NSLog" signature:"v@"))


Comment on this post ↓
Leave a Comment (sign in with Twitter)