Max_2003
asked on
erro C1083: cannot include netinet/in.h -- Plz help
Hey all
I am doing a client socket prog in C++. I have the code and when i compile it in MS Visual C++ 7, it is giving an error like this:
fatal error C1083: Cannot open include file: 'netinet.h': No such file or directory
What shud i do?
Max
I am doing a client socket prog in C++. I have the code and when i compile it in MS Visual C++ 7, it is giving an error like this:
fatal error C1083: Cannot open include file: 'netinet.h': No such file or directory
What shud i do?
Max
What functionality are you trying to include? Are you sure winsock.h or winsock2.h won't have what you need?
Search the VC++ path for "netinet.h" file.
If you find it, make sure that your VC++ options setting has this directory in the INCLUDE dir path.
If you don't have it, then you might need to install the latest SDK to your computer.
If you find it, make sure that your VC++ options setting has this directory in the INCLUDE dir path.
If you don't have it, then you might need to install the latest SDK to your computer.
I've searched the VS 2003 for both netinet and in.h and came up empty. I'm pretty sure you need to use a different interface for native MS Windows code, or else use something like Cygwin. For example, sockaddr_in is in winsock2.h.
If you're porting UNIX code, and you don't want to use Cygwin, then dedicate a couple of hours to study the documentation with an eye towards differences between UNIX (i.e. de facto standard) sockets and WinSock2.
Gary
If you're porting UNIX code, and you don't want to use Cygwin, then dedicate a couple of hours to study the documentation with an eye towards differences between UNIX (i.e. de facto standard) sockets and WinSock2.
Gary
ASKER
Thanx for all replies,
The code is for unix i think and I need for windows platform, i think i need to use winsock.h for it, but not sure . Someone told me that those header files are for unix systems.
Max
The code is for unix i think and I need for windows platform, i think i need to use winsock.h for it, but not sure . Someone told me that those header files are for unix systems.
Max
What functions are you trying to use? Most of them are defined in winsock.h or winsock2.h on windows.
ASKER
the thing is like this:
I have a client program which sends integers (or strings or double) using UDP protocol from a C++ client to a java Server. The java server part is there and now our c++ client has hearder files defines for unix system (i think so), like this
#include<stdio.h>
#include<errno.h>
#include<sys/types.h>
#include<netdb.h>
#include<netinet/in.h>
#include<sys/socket.h>
#include<sys/wait.h>
..
.
.
.
.
then we have methods for send intergers or strings
Also send and recv datagrams and send & recv ack
But when i compile this program in MS VC++, it shows error for headre files so i changes the header files to include windows system also but now also there is error but not in headre files but coding, is it becoz the rest of the coding could be for unix system only. and I have to replace the rest coding with compatible winsock APIs
Regards
Mohan
I have a client program which sends integers (or strings or double) using UDP protocol from a C++ client to a java Server. The java server part is there and now our c++ client has hearder files defines for unix system (i think so), like this
#include<stdio.h>
#include<errno.h>
#include<sys/types.h>
#include<netdb.h>
#include<netinet/in.h>
#include<sys/socket.h>
#include<sys/wait.h>
..
.
.
.
.
then we have methods for send intergers or strings
Also send and recv datagrams and send & recv ack
But when i compile this program in MS VC++, it shows error for headre files so i changes the header files to include windows system also but now also there is error but not in headre files but coding, is it becoz the rest of the coding could be for unix system only. and I have to replace the rest coding with compatible winsock APIs
Regards
Mohan
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.