CC_Fingers
CC_Fingers

Reputation: 31

Where to find missing "C" include files. (*.h)

I extracted a program from a stackoverflow answer and tried to compile it, using the MSVC++ V6 IDE, but the compiler complained that I don't have any of the following .h include files:

 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <net/if.h>
 #include <ifaddrs.h>
 #include <errno.h>

How do get these missing include files?

Upvotes: 1

Views: 1275

Answers (2)

Klas Lindb&#228;ck
Klas Lindb&#228;ck

Reputation: 33273

The missing header files are unix/linux headers.

The Windows socket API is slightly different from the Berkely socket API (sockets in Linux). In Windows, most declarations needed are available through a single include file, either the old winsock.h or the newer winsock2.h.

You will need to do some further modifications to port your code. There are good guides on porting socket applications to Winsock on MSDN.

Upvotes: 0

Learner
Learner

Reputation: 67

The header files which you mentioned above are related to linux based distribution. These are used for socket programming on linux. You can easily run this code on a linux based distro.

Upvotes: 2

Related Questions