sockets

Jesus Daniel Valencia Sanchez valencia at cicese.mx
Thu Mar 27 10:06:07 PST 2003



On Thu, 27 Mar 2003, Giorgos Keramidas wrote:

> On 2003-03-26 09:37, Jesus Daniel Valencia Sanchez <valencia at cicese.mx> wrote:
> >On Wed, 26 Mar 2003, Giorgos Keramidas wrote:
> >>On 2003-03-25 19:07, Jesus Daniel Valencia Sanchez <valencia at cicese.mx> wrote:
> >>>
> >>> I'm using R4.6.2 and when i try to compile anything with the file
> >>> sys/socket.h i get tons of error messages INSIDE that file.  is
> >>> there anything i should know about it?
> >>>
> >>> any help will be very appreciated
> >>
> >> Show us the exact command-line options you're using to compile your
> >> programs with and the errors you're getting.
> >
> > here you go
> >
> > [Equipo7] ~/programas/tontos> uname -a
> > FreeBSD Equipo7.mat.uson.mx 4.6.2-RELEASE FreeBSD 4.6.2-RELEASE #0: Thu
> > Feb  6 20:03:17 MST 2003
> > root at Equipo7.mat.uson.mx:/usr/src/sys/compile/GENERIC  i386
> > [Equipo7] ~/programas/tontos> g++ -o server_1 server_1.cpp
> > In file included from server_1.cpp:1:
> > /usr/include/sys/socket.h:52: syntax error before `;'
> 
> Line 52 of <sys/socket.h> in 4.6.2-RELEASE contains:
> 
>       49 /*
>       50  * Data types.
>       51  */
>       52 typedef u_char          sa_family_t;
>       53 #ifdef  _BSD_SOCKLEN_T_
>       54 typedef _BSD_SOCKLEN_T_ socklen_t;
>       55 #undef  _BSD_SOCKLEN_T_
>       56 #endif
> 
> Make sure you include <sys/types.h> before <sys/socket.h>.
> 
> > [Equipo7] ~/programas/tontos> cat server_1.cpp
> > #include <sys/socket.h>
> > #include <sys/types.h>
> 
> Wrong header order.  The <sys/socket.h> header uses some of the types
> that are defined in <sys/types.h>.
> 
> > #include <iostream.h>
> > #include <stdlib.h>
> >
> > void error( char *s )
> > {
> > .
> > .
> > .
> > and my code goes on...
> 
> PS: When you reply to a post, it's a good idea to Cc: both the list
> and the original sender.  I would have missed your followup post, if
> I hadn't been looking at the subjects of the list carefully enough.
> 
> 

Hello

thank you very much... that was it.

i wonder why didn't they #include <sys/types.h> inside sockets.h if it was 
needed.

-  have fun

Daniel Valencia


More information about the freebsd-questions mailing list