Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'readline/readline.h' file not found

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

like image 391
timeshift117 Avatar asked Apr 15 '14 13:04

timeshift117


People also ask

What is readline H?

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.

What is readline Ubuntu?

Readline is used to read a line after editing. To work with readline in C/C++, you must install the readline packages.

What is readline version?

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.


2 Answers

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 
like image 88
Mike Avatar answered Sep 23 '22 08:09

Mike


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' 
like image 36
λjk.jk Avatar answered Sep 19 '22 08:09

λjk.jk