我正在尝试编译一些代码,该代码尝试使用nameser_compat.h头文件中的一些定义。如果设置了某些BIND兼容性,则此文件显然作为nameser.h的一部分包含在其中。
我正在尝试在OSX上编译,显然没有设置此值,因此它没有拉取文件。除了nameser.h之外,我应该手动导入nameser_compat.h到我的代码中吗?
/usr/include/arpa/nameser.h
/usr/include/arpa/nameser_compat.h
/usr/include/nameser.h
xx.c
的文件中):#include <nameser.h>
int main(void) { return 0; }
然后像这样编译它,以获得所示的输出:
$ /usr/bin/gcc -O3 -g -std=c99 -Wall -Wextra -DBIND_8_COMPAT -H -c xx.c
. /usr/include/nameser.h
.. /usr/include/arpa/nameser_compat.h
... /usr/include/machine/endian.h
.... /usr/include/i386/endian.h
..... /usr/include/sys/cdefs.h
...... /usr/include/sys/_symbol_aliasing.h
...... /usr/include/sys/_posix_availability.h
..... /usr/include/sys/_endian.h
...... /usr/include/libkern/_OSByteOrder.h
....... /usr/include/sys/_types.h
........ /usr/include/machine/_types.h
......... /usr/include/i386/_types.h
....... /usr/include/libkern/i386/_OSByteOrder.h
.. /usr/include/sys/param.h
... /usr/include/sys/types.h
.... /usr/include/sys/appleapiopts.h
.... /usr/include/machine/types.h
..... /usr/include/i386/types.h
...... /usr/include/i386/_types.h
.... /usr/include/sys/_structs.h
... /usr/include/sys/syslimits.h
... /usr/include/machine/param.h
.... /usr/include/i386/param.h
..... /usr/include/i386/_param.h
... /usr/llvm-gcc-4.2/bin/../lib/gcc/i686-apple-darwin11/4.2.1/include/limits.h
.... /usr/llvm-gcc-4.2/bin/../lib/gcc/i686-apple-darwin11/4.2.1/include/syslimits.h
.... /Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/include/limits.h
..... /Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/include/syslimits.h
..... /usr/include/limits.h
...... /usr/include/machine/limits.h
....... /usr/include/i386/limits.h
........ /usr/include/i386/_limits.h
... /usr/include/sys/signal.h
.... /usr/include/machine/signal.h
..... /usr/include/i386/signal.h
...... /usr/include/i386/_structs.h
.... /usr/include/sys/_structs.h
..... /usr/include/machine/_structs.h
...... /usr/include/i386/_structs.h
....... /usr/include/mach/i386/_structs.h
Multiple include guards may be useful for:
/usr/include/sys/_symbol_aliasing.h
$
这表明设置了-DBIND_8_COMPAT
,将包括nameser_compat.h
头文件。源代码显示这是预期的:
#ifndef _NAMESER_9_H_
#define _NAMESER_9_H_
#ifdef BIND_8_COMPAT
#include <arpa/nameser_compat.h>
#endif