c - 将 readline.h 库导入到 Windows 上的 QtCreator

标签 c windows qt

我需要将 readline.h 库导入到 Windows。我已经尝试在此处导入带有库的文件夹: C:\Qt\Tools\mingw492_32\i686-w64-mingw32\include 它是一个库,有history.h、chardefs.h、keymaps.h、readline.h等。

但是当我尝试编译这样的程序时:

if ((line= readline("my_prompt$ ")) == NULL)
            exit(0);
add_history(line);

我收到此消息:

error: undefined reference to `add_history'
error: undefined reference to `impl__readline'

我真的需要它在我的机器上运行该库。非常感谢您的帮助!

最佳答案

您需要将库路径添加到您的 .pro 文件(不是您的 Makefile - 每次您更改项目配置中的任何内容时都会重写该路径):

LIBS += -lreadline

关于c - 将 readline.h 库导入到 Windows 上的 QtCreator,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35946616/

相关文章:

c - 为什么 unsigned int x = -1 和 int y = ~0 具有相同的二进制表示形式?

xml - 使用 sed(Windows + cygwin 和 Linux)更新 xml 属性?

windows - 对子目录中的每个文件执行,然后删除文件

c++ - QTextStream 没有输出任何东西,我做错了什么?

c - 未定义的乘法引用

c - 获取RHEL6内核代码

C 编程多线程段错误

c# - Windows 平台上的 .NET Mutex : What happens to them after I'm done?

c++ - 委托(delegate) : no repaint upon mouseover, 中的 QWidget 因此无法检查 MouseOver 状态

c++ - QLabel show 命令打开新窗口