Hi,

I need the following headers.

#include "unistd.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/un.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <netdb.h>

I been looking on the internet and find it hard to get downloadable versions of these headers. Instead, often I have to copy paste into a new file. While this is not that bad, i not sure always on the reliabilty of the code i pasting in.

Can anyone point me to a good website with a large header resource.

My guess is that you are using MS-Windows and you want to compile a program written for *nix. If you install gcc or Dev-C++ you might be able to compile it ok. If you don't have one of those two compilers then your only resort is a complete rewrite of the program using MS-Windows API functions. Getting the header files is of no value without the libraries to go along with them, and libraries are often compiler dependent.

I just downloaded dev-c++ and I got all the header files i need. However, are you saying that I cannot simply copy the header files from dev-c++ to my visual studio folder because they are incompatable due to using a different compiler? i using the visual studio compiler and intel C++ compiler.

No, what he said is the headers have no code associated with them. Headers don't do anything. It's the libraries (code) that are associated with the headers that process the functions. Without them, the header is useless.

Hi, i`m having the same issue, i cant compile because i dont have these headers, i`ve downloaded Dev-c++ just like yourself, Does anyone has another solution? or tell me where i can download these headers.
Thanks.

Didn't you even bother to read Walt's comment just above yours ????

>>Does anyone has another solution?
Yes -- you have at least a couple of options

  • Rewrite the code using Win32 api functions
  • Use a different compiler such as Dev-C++

Dev-C++ on windows uses the Mingw port of GCC by default.
MinGW uses native Windows DLLs for everything; code compiled with MinGW will use standard Microsoft runtime libraries such as MSVCRT.DLL.

Dev-C++ can also be used in combination with Cygwin and this is what you need to do if you want to use unix-like libraries and headers. Cygwin relies on a Unix emulation layer, code compiled with Cygwin uses the standard GNU runtime library (glibc) with an emulation of Unix system calls like fork, and semantics like mount points, pipes and path separators.

however, Cygwin has a restrictive (viral) license, whereas MinGW is available under a free license.

I need the following headers.

#include "unistd.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/un.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <netdb.h>

Based on above headers I presume you are attempting to use Unix socket API and compile it in Windows platform? In Windows you use Winsock API instead to do that. To solve this portability issues you face, take a look at ACE (Open Source framework and classes) that follow something like Java JVM concept. You have ACE for Windows, ACE for Linux, ACE for various Unix, ACE for VxWorks etc etc.

Then within your application code you code only ONE consistent API and the underlying ACE implementation handle the rest. ACE and Java has very close ideas in this portability approach.

Of cuz you now need ACE headers instead of those headers you mention above. Imagine you write one set of code and without modifying compile it perfectly across different platforms. In Java you have Socket, ServerSocket, in ACE you have ACE_Sock_Connector and ACE_Sock_Acceptor. Java has Selector, ACE has ACE_Reactor and ACE_Proactor.

Of cuz again for GUI and database access, ACE is still not there yet as compared to Java.

Hehm, excuseme, I downloaded Dev-C++ that is my ordinary compiler, but I can't find those librarie, that are the same I am looking for...
I miss:
#include <netinet/in.h>
#include <sys/wait.h>
#include <sys/socket.h>

Can someone upload them somewhere or simply mail me tham at: SNIP

I am looking for this from more that 4 Months! Thanks.

Edited 6 Years Ago by happygeek: keep it onsite

Comments
Did you read the posts above???

@moderator: I read the posts above, but I still can't find them... about the mail con I post in [] format? If yes: SNIP

Edited 6 Years Ago by happygeek: keep it onsite

@bruce965: That compiler/IDE has not been updated for quite a few years -- delete it from your computer and upload free Code::Blocks or VC++ 2010 Express.

You are right -- Code::Blocks with MinGW does not contain those header files either. Under MS-Windows, <sys/socket.h> can be replaced with <winsock2.h> and the project will have to use ws2_32.lib library. There may not be a windows port of the other two header files.

Ok, so... Project abandoned... :-( Ok... I am new in C programming, so, I MUST use already made examples, when I will be "level upped", I will take back this project.

Now I am continuing it in Python. Thanks Everybody!

|I'm in the same boat. Just want a couple of files. I'm drowning in words,words,words,words and going round in circles. No wonder the human race is in such a mess.

If you install gcc or Dev-C++ you might be able to compile it ok. I

AD,
DevCpp died way back and its MinGW version is likely to be outdates. I know two actively developed IDE both with Mingw bundle and both supports vc compiler too. They are like Essau and Jacob you know: CodeLite and Code::Blocks

EDIT:
I was a bit quick and slipped on previous post.
I think DevCPP site should close and let wxDevC++ be its successor as it is actively developed

Edited 6 Years Ago by Stefano Mtangoo: n/a

|I'm in the same boat. Just want a couple of files. I'm drowning in words,words,words,words and going round in circles. No wonder the human race is in such a mess.

Perhaps you should tell what you want exactly, so we can give you a descent answer.

Edited 6 Years Ago by Nick Evan: n/a

AD,
DevCpp died way back and its MinGW version is likely to be outdates.

I suppose you didn't notice that I posted that over two years ago :)

I suppose you didn't notice that I posted that over two years ago :)

I didn't :)
I don't know why the site is up and IDE remains outdated for 5 years :icon_rolleyes:

Edited 6 Years Ago by Stefano Mtangoo: n/a

please need a good wed site for c&c++ header files. which is very use full to mca & computer courses stream

This article has been dead for over six months. Start a new discussion instead.