Undefined symbols for architecture x86_64:
"_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)
Thanks for the help, I ran into this same problem. I knew it had to be something simple, since readline() used to work, but I had totally forgotten about this.
Sorry, but i thought that by typing #import <readline/readline.h> at the top of the project, he is already added the required library.
I have done the same but cannot get rid of the error:
Undefined symbols for architecture x86_64:
"_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)
Please help!!!
*** I’m using Xcode 4.4. If that’s the problem, is there an other way of reading strings from the command line?
I am sure the book has asked you to add a framework or library to your project, and most likely you forgot to do it.
#importing a file does not automatically add the associated frameworks or libraries to your project; remember, you are programming in Objective-C, not Java!
I think you can’t pass readline(NULL) as an argument. In the line:NSString * string =[NSString stringWithUTF8String:readline(NULL)]; you need to add a const char instead of readline thing. which you declare before so here is how it should look like: