I write this codes to solve the challenge in chapter 18. It’s failed after running. and tell me reason: “_readline”, referenced from: **
** _main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
.
.
and that’s the codes below:
#import <Foundation/Foundation.h>
#import <readline/readline.h>
int main(int argc, const char * argv[]) {
_ @autoreleasepool {_
_ _
_ NSString *ask = @“who is smart?”;_
_ NSLog(@"%@",ask);_
_ const char *answer = readline(NULL);_
_ NSString *answer2 = [NSString stringWithUTF8String:answer];_
_ _
_ NSString *display = [NSString stringWithFormat:@"%@ is smart",answer2];_
_ NSLog(@"%@",display);_
_ // insert code here…_
_ NSLog(@“Hello, World!”);_
_ }_
_ return 0;_
}