DEV Community

sydney
sydney

Posted on

DevC++ project problem

I have a DevC++ project that has a file that #includes netinet/in.h in it, but the compiler can't find this in.h library! The <> brackets that surround the .h include are <> and will not allow the #include to show up in this post. The <> indicate that this library should be in the compilers library of system files. This project was from an old c code book on algorithms, so maybe the code in not compatible with the newer compiler? How do I solve this library problem?
syd

Top comments (3)

Collapse
 
phlash profile image
Phil Ashby

Hi @syd_71, you may find more people see your question's if you tag them, we have moderated tags for both #c and #cpp (C++).

Regarding the question itself - netinet/in.h is a system header on Unix-like operating systems defining the internet protocol socket structures. On Windows (I assume, since you are using DevC++) this does not exist, instead you will find all the relevant type definitions in winsock.h. Unfortunately you are about to discover the joys of operating system incompatabilities.. good luck!

Collapse
 
syd_71 profile image
sydney

Well now that I have a discussion, it's good to know that the forum is active. Will look into the tags thing a try again later. After a quick look around on the net I did find some documents on winsock.h. It looks like a lot of #define in this and I think i saw some function prototypes which makes me wonders if there is an associated .c file to go with the header. I suppose I can paste the online text into and make a winsock.h file of my own and use it in the project. getting a download site doesn't seen very easy to find. syd

Collapse
 
phlash profile image
Phil Ashby

You should have a Windows SDK included with DevC++ (actually, with the Mingw compiler it uses), and thus should be able to directly refer to the Windows specific headers (eg: winsock.h) rather than copy/pasting them from random forums 😁 DevC++ also provides the Windows specific libraries for the socket API. This thread from 12 years ago is still relevant(!): edaboard.com/threads/linker-errors...

In case you haven't seen it, this DevC++ page links to a tutorial for writing Win32 programs: dev-cpp.com/Additional-Resources amongst other useful resourcces.. good luck!