views:

77

answers:

2

hello, i am trying to use the GCMathParser for an iphone application and i cannot find any support on implementing this framework. people keep saying its easy and im kinda confused, any help would be great thanks!

+4  A: 

There are two changes you need to make in order to use this:

  1. Change #import <Cocoa/Cocoa.h> to #import <UIKit/UIKit.h> (You could probably get away with using <Foundation/Foundation.h>, too)
  2. Try to compile again. You'll get errors about an unknown symbol "pi". Change the three occurrences of those to M_PI (the constant defined in <math.h> for π).

You'll still get warnings (about deprecated methods), but it will compile and work.

Dave DeLong
worked perfectly thank you! im just not too accustomed with os x programming vs iphone programming i guess haha
Sj
If you have any additional questions, Graham Cox, the author of GCMathParser, is very responsive.
Brad Larson
+2  A: 

If you have UI classes, then you will need to remove them (as you noted you have). If you have non-UI classes importing Cocoa.h, they generally shouldn't be (AppKit, which is implemented in Cocoa.h, is mostly UI). Replace Cocoa.h with #import <Foundation/Foundation.h>. If they actually rely on things in Cocoa.h, then you have porting work to do.

Rob Napier