Search code examples
iphoneobjective-ccocoa-touchobjective-c++

NSStringFromPoint disappears under Objective-C++


The function NSStringFromPoint disappears when I compile my code using objective-C++, but it's fine under objective-C.

How can I make objective-C++ see that function?

If I compile under Objective-C++ it says:

error: 'NSStringFromPoint' was not declared in this scope
error: 'NSStringFromRect' was not declared in this scope
error: 'NSEqualSizes' was not declared in this scope

Solution

  • Someone can correct me if I'm wrong, but if you're linking against the iPhone SDK, there is no NSPoint or NSStringFromPoint. UIKit uses the Core Graphics structs CGPoint, CGSize and CGRect. The equivalent function would be NSStringFromCGPoint.

    The Simulator libraries do not quite match up with the iPhone libraries -- I'm fairly certain applications compiled for the simulator link against the Mac's own Foundation.framework. For example, I wasted a lot of time in the pre-2.0 days thinking that NSXMLDocument was available on iPhone because it compiled and ran in the simulator.