Fatal Error
I am working on makeyourownlisp,where in editline/readline.h and editline/history.h have to be added to the program. Following is the code snippet
#include<stdio.h>
#include<stdlib.h>
#include<editline/readline.h>
#include<editline/history.h>
static char input[2048];
int main(int argc, char** argv)
{
printf("CLISP version 1.02\n");
printf("Ctrl + c to exit\n");
while(1)
{
char * input = readline(">>> \n");
add_history(input);
printf("%s", input);
free(input);
}
}
I have already installed libedit-20170329-3.1(containing the above mentioned header files) but how to use the files and get the code rolling is something I need help about.
On Debian Buster 10, I had to install the package with:
sudo apt install libeditline-dev
Instead of:
#include <editline/readline.h>
#include <editline/history.h>
I just included:
#include <editline.h>
ran the program with -leditline flag and worked perfectly. Note that I was executing the portable program for both Windows and UNIX systems. Following the tutorial, that piece of my code would look like:
// otherwise include the editline headers
#else
#include <editline.h>
#endif
Hope that helped. Awesome tutorial btw.
I faced this issue in the ubuntu 18.04 version, installing the following packages worked for me
sudo apt install libeditline-dev
sudo apt-get install libedit-dev
I refer to the following thread Readline-Issue
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With