Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Mar 2003 00:25:37 +0200
From:      Giorgos Keramidas <keramida@ceid.upatras.gr>
To:        Jesus Daniel Valencia Sanchez <valencia@cicese.mx>
Cc:        freebsd-questions@FreeBSD.org
Subject:   Re: sockets
Message-ID:  <20030326222537.GB19762@gothmog.gr>
In-Reply-To: <Pine.SUN.3.91.1030326093328.15768A@matrix>
References:  <20030326034042.GA16205@gothmog.gr> <Pine.SUN.3.91.1030326093328.15768A@matrix>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2003-03-26 09:37, Jesus Daniel Valencia Sanchez <valencia@cicese.mx> wrote:
>On Wed, 26 Mar 2003, Giorgos Keramidas wrote:
>>On 2003-03-25 19:07, Jesus Daniel Valencia Sanchez <valencia@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@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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030326222537.GB19762>