c - OpenBSD 上的 <resolv.h> 给出不完整的类型错误

标签 c gcc openbsd

我的ssl bindings for R在 linux、osx、windows 和 solaris 上编译,但在 OpenBSD 上包含 resolv.h 时会失败。这是 OpenBSD 中的错误吗?我应该(不)首先包含一些其他 header 吗?

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>

关于c - OpenBSD 上的 <resolv.h> 给出不完整的类型错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35359456/

相关文章:

python - 如何在Python中将一维C数组绘制为曲面

c - 一个句子的平均字长

c - 我对 C 中的 SPI_connect ()、Postgresql 有问题

c++ - 可以编辑 GCC "bits/g++config.h"中的定义吗?

regex - Grep 在 OpenBSD 和 Linux 中的行为不同。无法使命令工作

shell - 使用 ksh 进行主页、结束、删除、向上翻页、向下翻页

C:如何才能使 scanf() 输入具有两种格式之一?

c++ - gcc 用于解析代码

c++ - 在 win7 上使用 MinGW 6.3.0 构建 boost 1.63.0

python - 在 chroot 环境 OpenBSD 中配置设备