C <;决议h>;在OpenBSD上提供不完整的类型错误
我在linux、osx、windows和solaris上编译,但在OpenBSD上,当包含C <;决议h>;在OpenBSD上提供不完整的类型错误,c,gcc,openbsd,C,Gcc,Openbsd,我在linux、osx、windows和solaris上编译,但在OpenBSD上,当包含resolv.h时,编译失败。这是OpenBSD中的错误吗?我应该(不)先包括一些其他标题吗 egcc -std=gnu99 -I/usr/local/lib/R/include -DNDEBUG -I/usr/include -I/usr/local/include -fpic -O2 -pipe -c ssl.c -o ssl.o In file included from ssl.c:14:
resolv.h
时,编译失败。这是OpenBSD中的错误吗?我应该(不)先包括一些其他标题吗
egcc -std=gnu99 -I/usr/local/lib/R/include -DNDEBUG -I/usr/include -I/usr/local/include -fpic -O2 -pipe -c ssl.c -o ssl.o
In file included from ssl.c:14:0:
/usr/include/resolv.h:137:3: error: array type has incomplete element type
nsaddr_list[MAXNS]; /* address of name server */
^
/usr/include/resolv.h:147:18: error: field 'addr' has incomplete type
struct in_addr addr;
^
/usr/include/resolv.h:164:19: error: field 'ina' has incomplete type
struct in_addr ina;
^
/usr/include/resolv.h:165:20: error: field 'in6a' has incomplete type
struct in6_addr in6a;
^
/usr/local/lib/R/etc/Makeconf:134: recipe for target 'ssl.o' failed
gmake: *** [ssl.o] Error 1
评论中给出了正确答案:
#include <netinet/in.h>
#include <resolv.h>
#包括
#包括
9K用户应该知道代码必须被发布,而不是链接…尝试在resolv.h
之前包含,但它应该位于resolv.h
的顶部。谢谢你的帮助。