I just switched my code from Objective-C to Objective-C ++. Everything goes smoothly, with the exception of two lines.
NSString * text1=[[NSString stringWithFormat:@"%.2f",ymax] UTF8String];
This line complains that
error: cannot convert 'const char*' to 'NSString*' in initialization
The second error associated with the first is related to the line:
CGContextShowTextAtPoint(context, 2, 8, text1, strlen(text1));
He complains that
error: cannot convert 'NSString*' to 'const char*' for argument '1' to 'size_t strlen(const char*)'
Is there something I missed in the differences between ObjC and ObjC ++?
source
share