C Socket Programming with CygWin

13,065

Solution 1

Try using the -I compiler command line option to specify a path to the header files.

My local reference states

-I dir
       Add the directory dir to the list of directories to be searched for
       header files.  Directories named by -I are searched before the
       standard system include directories.  If the directory dir is a
       standard system include directory, the option is ignored to ensure
       that the default search order for system directories and the
       special treatment of system headers are not defeated . 

Solution 2

I also had same problem.. i was googling for hours and finally found this... thanks to ralph...

https://ralphexe.wordpress.com/2015/09/09/run-unix-socket-program-in-windows-using-cygwin/

For socket commands you have to include some of the packages in cygwin while installing... (If you have installed try reinstalling ...)

During the installation :

  1. In "SELECT PACKAGES " phase of installation.

  2. Expand DEVEL

  3. select GNU compilers for c and c++

    4.And click next and complete the installation.

enter image description here

NOW, try with a socket program involving sys/socket.h ... I HOPE IT WILL WORK ... :-)..

Share:
13,065
Admin
Author by

Admin

Updated on June 04, 2022

Comments

  • Admin
    Admin almost 2 years

    Hi I'm trying to write a little server / client program in C using CygWin, problem is, the gcc compiler in Cygwin doesn't seem to contain the standard headers assosiated with socket-programming. When trying to compile my server program, i get:

    netinet/in.h: No such file or directory
    sys/socket.h: No such file or directory
    netdb.h: No such file or directory
    

    Are these three headers located elsewhere in the CygWin-enviorment?