c - 如何在 Kali 上使用 C 中的 ncurses 编译“Hello World”
问题描述
我已经在 Kali 中成功安装了 ncurses(至少 ncurses-6.1/test 文件夹中包含的示例有效),但我自己无法编译任何东西。
我的代码:
#include <stdlib.h>
#include <ncurses.h>
int main(void)
{
initscr();
printw("Hello World!!");
refresh();
getch();
endwin();
return 0;
}
编译失败:
gcc game.c -lncurses
fatal error: ncurses.h: No such file or directory
我已经详尽地研究了这个类似的问题,其中包括:
不幸的是,在尝试了包括 curses.h 与 ncurses.h 的各种排列、使用 -lncurses 或 -lncursesw 等进行编译之后,我不得不向社区寻求帮助!
解决方案
听起来像您手动安装的。如果是这种情况,那么您需要#include "/path/to/ncurses.h"
安装它的任何地方。
如果你使用 aptitude(afaik 是默认的 Kali 包管理器),你可能需要通过apt-get install libncurses-dev
.
希望有帮助。
推荐阅读
- docusignapi - 文档认证
- hadoop - 如何获取特定正在运行的 hadoop 作业的作业 ID
- git - 发布后 Jenkins 的 Git Tag
- javascript - AppleScript 中的 Javascript '不能将脚本变成类型说明符'(用于单击 Chrome 中的按钮)
- javascript - 向不同方向移动页面上的多个图像
- nginx - 如何设置proxy_pass来获取想要的地址?
- browserstack - 为什么通过 curl on log in (OS X) 连接到 browserstack.com?
- java - 线性布局中setVisibility和layout_weight有什么联系
- linux-kernel - 使用我的内核模块查找用户进程的 PID
- javascript - PWA 无法在 iphone/ipad 上以全屏模式打开