/usr/include/resolv.h syntax error!!!!

I tried to include <resolv.h> in my program since i need to use res_init(),
res_query() etc. compiler says /usr/include/resolv.h line 135 and 136 has
syntax errors:

int res_query(char *dname, int class, int type, u_char *answer, int anslen);

int res_search(char *dname, int class, int type, u_char *answer, int
anslen);

i believe its the word ‘class’ in both lines, they are reserved words for
c++.

what should I do???

Ran Zhang <rzhang@vamcointernational.com> wrote:

I tried to include <resolv.h> in my program since i need to use res_init(),
res_query() etc. compiler says /usr/include/resolv.h line 135 and 136 has
syntax errors:

int res_query(char *dname, int class, int type, u_char *answer, int anslen);

int res_search(char *dname, int class, int type, u_char *answer, int
anslen);

i believe its the word ‘class’ in both lines, they are reserved words for
c++.

what should I do???

Looked at an internal one, and it’s prototyping is done quite differently.
Not sure the versioning on the header, or whether it’s part of an update,
but for now I’d suggest just editing the header file. Since the above
lines are just prototypes, they don’t actually even need variable names
at all, and any variable names given are, essentially, just for commenting
purposes.

So, you could just make them:
int res_query(char *, int, int, u_char *, int);
int res_search(char *, int, int, u_char *, int);

-David

David Gibbs
QNX Training Services
dagibbs@qnx.com