I have included:
#include "stdio.h" #include <readline/readline.h> #include <readline/history.h>
and my compiler includes the flag
-lreadline
but I am still receiving the error message:
fatal error: 'readline/readline.h' file not found
I am trying to use the function, readline();
Defined in more detail here: http://linux.die.net/man/3/readline
This file is part of the GNU Readline Library (Readline), a library. for reading lines of text with interactive input and history editing. Readline is free software: you can redistribute it and/or modify. it under the terms of the GNU General Public License as published by.
Readline is used to read a line after editing. To work with readline in C/C++, you must install the readline packages.
The current version of readline is readline-8.1. (GPG signature). A downloadable tar file of the current version with all official patches applied is available from the GNU git repository. A snapshot of the current development sources (generally updated monthly) is also available from the GNU git readline devel branch.
You reference a Linux distribution, so you need to install the readline development libraries
On Debian based platforms, like Ubuntu, you can run:
sudo apt-get install libreadline-dev
and that should install the correct headers in the correct places,.
If you use a platform with yum
, like SUSE, then the command should be:
yum install readline-devel
This command helped me on linux mint when i had exact same problem
gcc filename.c -L/usr/include -lreadline -o filename
You could use alias if you compile it many times Forexample:
alias compilefilename='gcc filename.c -L/usr/include -lreadline -o filename'
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