c - Use of resolv.h -


i'm trying find out dns server address reading resolv.h's _res struct. according man 3 resolver setup code should be.

#include <netinet/in.h> #include <arpa/nameser.h> #include <resolv.h> extern struct state _res; 

and read out whatever need. problem trying compile get

resolver.c:5:21: error: conflicting types '__res_state' extern struct state _res; ^ /usr/include/resolv.h:251:16: note: expanded macro '_res' #define _res (*__res_state()) ^ /usr/include/resolv.h:249:28: note: previous declaration here extern struct __res_state *__res_state(void) __attribute__ ((__const__)); ^ 1 error generated. 

by clang.

what doing wrong?

you shouldn't declare _res - resolv.h includes right declaration (despite man page implies).


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -