如何为 <stropts.h> 安装库?

Mac*_*exa 4 c c++ debian gcc

我正在运行 Kali-Linux (debian+gnome)。编译时出现编译错误:

cc -Wall -g   -c -o frag.o frag.c
frag.c:7:10: fatal error: stropts.h: No such file or directory
    7 | #include <stropts.h>
      |          ^~~~~~~~~~~
compilation terminated.
make: *** [<builtin>: frag.o] Error 1
Run Code Online (Sandbox Code Playgroud)

谁能告诉我我缺少什么以及我应该安装什么?我尝试安装 glibc-sources,但仍然没有成功。

小智 5

正如另一个答案所提到的,这个库不在 Linux 上使用。由于这是在 Linux 上尝试编译应用程序时出现的,因此可能#if设置不正确。

作为一种解决方法,查看源代码以查看#if周围的#include内容,并在编译时将其设置为 false。

例如,如果代码如下所示:

#if HAVE_STROPTS_H
#include <stropts.h>
#endif
Run Code Online (Sandbox Code Playgroud)

如果您使用的是 cmake 或 gcc,请使用-DHAVE_STROPTS_H=0.