我很難搞清楚如何在AIX 7.1中添加getopt.h。我在我的代碼中使用了getopt_long
函數,我知道它是在getopt.h而不是unistd.h(其中包含getopt()
)。aix中缺少getopt.h 7.1
此代碼不能編譯在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'和'getopt_long_only'是在AIX中可能不存在的特定於GNU的函數。 –
'getopt_long'是一個GNU函數。我不知道它是否有幫助,但在我的Debian Linux機器上,'dlocate'報告'libc6-dev:amd64:/ usr/include/getopt.h' - 即它是** GNU libc **的一部分。在最壞的情況下,你可能不得不求助於'autoconf'測試,並且寫一個'#ifdef',當它沒有找到'getopt_long()'時只允許短的選項。 –