# Where are the headers ?



## apaschou (Oct 29, 2003)

Hi all,

I can't understand where the compiler find the header files... I just want to compile a simple program to test a tcp/ip connection. I did next includes :

#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>

int accept_con()
{
   int sockfd;
   struct sockaddr_in my_addr;
.
.
.
}

But I get the error : "accept_con.c:11: storage size of `my_addr' isn't known
". This should mean (I suppose) that "struct sockaddr_in"  is not defined. So I wanted to have a look in socket.h to know what's wrong.

I did a search of "socket.h" on my hard disc. I found 10 of them... and because I didn't find a way to know which one ProjectBuilder includes, I started to change the name of all of then until I find the one that is included.

BUT, I changed all file names, and the compiler ALWAYS find the file. WHERE does he find this file ? Where can I find the pathes that are used by gcc to find headers and libraries ?

Thank you for any help.

Alain Paschoud


----------



## anarchie (Oct 29, 2003)

Compiler header files are kept in /usr/include.

So, your socket.h would be /usr/include/sys/socket.h

Also, sockaddr_in is defined in <netinet/in.h>


----------

