Search code examples
clinuxlibreadline

'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


Solution

  • 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