gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-30 17:04:04 24 4
gpt4 key购买 nike

我需要将 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com