getopt.h missing in aix 7.1

getopt.h missing in aix 7.1

本文关键字:aix in missing getopt      更新时间:2023-10-16

我很难弄清楚如何在AIX7.1中添加getopt.h。我在代码中使用getopt_long函数,我知道它在getopt.h中,而不是unistd.h(它包含getopt())。

此代码不是在AIX:中编译的

fatal error: getopt.h: No such file or directory
 #include <getopt.h>
                    ^
compilation terminated.

以下是安装的gcc软件包:

gcc-4.8.3-1.aix7.1.ppc.rpm
gcc-c++-4.8.3-1.aix7.1.ppc.rpm
libgcc-4.8.3-1.aix7.1.ppc.rpm
gcc-cpp-4.8.3-1.aix7.1.ppc.rpm

我已经浏览了这些链接,但它们没有太大帮助:

  • http://www.ibm.com/developerworks/aix/library/au-unix-getopt.html#sthash.Loz3H0AH.dpuf
  • http://www.linuxmisc.com/8-freebsd/eb9bdab1cf6044d5.htm

还有很多其他的网络搜索。

我是缺少了一些rpms,还是缺少了一些环境变量?

getopt_long仅是GNU,但您可以获得免费实现(例如,如果我理解正确的话,这声称它是BSD许可证)或编写自己的实现(不那么难)并在代码中使用它。