'readline/readline.h' file not found

笑着哭i 提交于 2019-12-18 11:06:20

问题


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


回答1:


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



回答2:


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'


来源:https://stackoverflow.com/questions/23085076/readline-readline-h-file-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!