Search code examples
c++cgccdebian

How do I install libraries for <stropts.h>?


I am running Kali-Linux (debian+gnome). When I compile I get compilation error:

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

Can anyone tell me what am I missing and what should I install? I tried installing glibc-sources but still it didn't work out.


Solution

  • As mentioned by the other answer, this library is not used on Linux. Since this came up when trying to compile an application on Linux, it's possible an #if was not set correctly.

    As a workaround, look at the source code to see what the #if surrounding the #include is, and set that to false when compiling.

    For example, if the code looked like:

    #if HAVE_STROPTS_H
    #include <stropts.h>
    #endif
    

    And if you are using cmake or gcc, run them with -DHAVE_STROPTS_H=0.