2

Is there a way to use netdb.h in ansi C? I want to use gcc with -ansi flag, but I have similar erros like in this post netdb.h not linking properly , is it possible to solve the ansi c - compliance? If not what networking libraries should I use?

Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105
Pio
  • 4,044
  • 11
  • 46
  • 81
  • The same as in the linked question: ... error: `'AI_PASSIVE' undeclared` ... and so on. I've built a code similar to the one in the post. – Pio Oct 20 '12 at 10:31

1 Answers1

0

-ansi is simply to tell the compiler which mode to be used. That shouldn't cause any issue here. Besides, -ansi is the default standard being followed by most compilers even now.

What you see is simply a compilation error. Find the netdb.h on your system and include it in your source with correct path to it. If you don't have it, download it from Internet and then include it, then try to compile to see if the errors go away.

P.P
  • 117,907
  • 20
  • 175
  • 238