我很难弄清楚如何在我的 AIX 7.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
还有很多其他网络搜索。
我是否遗漏了某些 rpm 或某些环境变量?
最佳答案
getopt_long
是 GNU-only,但你可以自由实现(例如,this 声称它是 BSD 许可证,如果我理解正确的话)或编写你自己的实现(它是没那么难)并在您的代码中使用它。
关于c++ - aix 7.1 中缺少 getopt.h,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34044975/