everybody, I am new to Stack Overflow (and DDMathParser), but came here because of a weird problem that occurred when I was trying to use DDMathParser in an objective-c++ file (main.mm). No matter how simple the code was, it would give a thread error. Here's my code:
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <math.h>
#include <iostream>
#import "DDMathParser.h"
#import "NSString+DDMathParsing.h"
#import <Cocoa/Cocoa.h>
#import <Foundation/Foundation.h>
int main(int argc, char * argv[])
{
NSLog(@"%@", [@"5 + 5" numberByEvaluatingString]);
}
And here's the console after running:
2015-08-29 09:23:09.788 calculator[6212:101522] -[__NSCFConstantString numberByEvaluatingString]: unrecognized selector sent to instance 0x100001060
2015-08-29 09:23:09.792 calculator[6212:101522] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFConstantString numberByEvaluatingString]: unrecognized selector sent to instance 0x100001060'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff9365d03c __exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff8fddd76e objc_exception_throw + 43
2 CoreFoundation 0x00007fff936600ad - [NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00007fff935a5e24 ___forwarding___ + 1028
4 CoreFoundation 0x00007fff935a5998 _CF_forwarding_prep_0 + 120
5 calculator 0x0000000100000e86 main + 38
6 libdyld.dylib 0x00007fff864595c9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Any suggestions?