i am trying to run this code but the compiler fails : undefined reference to ' readline ' and undefined reference to ' add_history ' .I am using CodeBlocks .This is my code :
#include <stdio.h>
#include <stdlib.h>
#include <readline/readline.h>
#include <readline/history.h>
int main()
{
char *buf;
while((buf = readline("\n >> "))!=NULL)
{
if (strcmp(buf,"quit")==0)
break;
printf("[%s]\n",buf);
if (buf[0]!=0)
add_history(buf);
}
free(buf);
return 0;
}