Subject: #include problem
To: None <port-sparc@netbsd.org>
From: Jan Senolt <senolt@sps-jia.cz>
List: netbsd-help
Date: 12/28/2001 13:51:23
This is a multi-part message in MIME format.

------=_NextPart_000_0079_01C18FA6.BC7C7260
Content-Type: text/plain;
	charset="iso-8859-2"
Content-Transfer-Encoding: quoted-printable

Hi,

I have problem with include any headers files (e.g. =
/usr/include/sys/socket.h) to my C program:
When I try compile this "program":

#include <sys/socket.h>
void main(){
}

I've got those errors:

In file included from test.c:1:
/usr/include/sys/socket.h:186: syntax error before `u_char'
/usr/include/sys/socket.h:214: syntax error before `u_char'
/usr/include/sys/socket.h:216: `int64_t' undeclared here (not in a =
function)
/usr/include/sys/socket.h:216: `u_char' undeclared here (not in a =
function)
/usr/include/sys/socket.h:216: size of array `__ss_pad1' is negative
/usr/include/sys/socket.h:217: syntax error before `int64_t'
/usr/include/sys/socket.h:218: `u_char' undeclared here (not in a =
function)
/usr/include/sys/socket.h:218: `int64_t' undeclared here (not in a =
function)
/usr/include/sys/socket.h:218: `u_char' undeclared here (not in a =
function)
/usr/include/sys/socket.h:218: `int64_t' undeclared here (not in a =
function)
/usr/include/sys/socket.h:273: syntax error before `uid_t'
/usr/include/sys/socket.h:278: syntax error before `gid_t'
/usr/include/sys/socket.h:452: syntax error before `u_short'=20
/usr/include/sys/socket.h:460: syntax error before `caddr_t'
/usr/include/sys/socket.h:464: syntax error before `caddr_t'
/usr/include/sys/socket.h:485: syntax error before `recv'=20
/usr/include/sys/socket.h:485: syntax error before `size_t'
/usr/include/sys/socket.h:485: warning: data definition has no type or =
storage class=20
/usr/include/sys/socket.h:486: syntax error before `recvfrom'
/usr/include/sys/socket.h:486: syntax error before `size_t'
/usr/include/sys/socket.h:487: warning: data definition has no type or =
storage class
/usr/include/sys/socket.h:488: syntax error before `recvmsg'
/usr/include/sys/socket.h:488: warning: data definition has no type or =
storage class=20
/usr/include/sys/socket.h:489: syntax error before `send'=20
/usr/include/sys/socket.h:489: syntax error before `size_t'=20
/usr/include/sys/socket.h:489: warning: data definition has no type or =
storage class=20
/usr/include/sys/socket.h:490: syntax error before `sendto'=20
/usr/include/sys/socket.h:491: syntax error before `size_t'
/usr/include/sys/socket.h:491: warning: data definition has no type or =
storage class=20
/usr/include/sys/socket.h:492: syntax error before `sendmsg'
/usr/include/sys/socket.h:492: warning: data definition has no type or =
storage class=20

(I used NetBSD 1.5.2 on sparc)

And this is part of /usr/include/sys/socket.h around line 186:
...
/*
 * Structure used by kernel to store most
 * addresses.
 */
struct sockaddr {
 u_char sa_len;   /* total length */                                =
(<----- this is line 186 )
 u_char sa_family;  /* address family */
 char sa_data[14];  /* actually longer; address value */
};

#if defined(_KERNEL)
/*
 * Structure used by kernel to pass protocol
 * information in raw sockets.
 */
struct sockproto {
 u_short sp_family;  /* address family */
 u_short sp_protocol;  /* protocol */
};
#endif /* _KERNEL */
...

Would you tell me what is wrong (and how to correct it :-) pleas ? I'm =
new user of NetBSD (before I use Linux and Minix) and I don't know what =
to do.

Thanks a lot.
Honza


------=_NextPart_000_0079_01C18FA6.BC7C7260
Content-Type: text/html;
	charset="iso-8859-2"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-2">
<META content=3D"MSHTML 5.50.4134.600" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I have problem with include&nbsp;any =
headers files=20
(e.g. /usr/include/sys/socket.h) to my C&nbsp;program:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>When I try compile this =
"program":</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>#include =
&lt;sys/socket.h&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>void main(){<BR>}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I've got those errors:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>In file included from =
test.c:1:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>/usr/include/sys/socket.h:186: syntax =
error before=20
`u_char'<BR>/usr/include/sys/socket.h:214: syntax error before=20
`u_char'<BR>/usr/include/sys/socket.h:216: `int64_t' undeclared here =
(not in a=20
function)<BR>/usr/include/sys/socket.h:216: `u_char' undeclared here =
(not in a=20
function)<BR>/usr/include/sys/socket.h:216: size of array `__ss_pad1' is =

negative<BR>/usr/include/sys/socket.h:217: syntax error before=20
`int64_t'<BR>/usr/include/sys/socket.h:218: `u_char' undeclared here =
(not in a=20
function)<BR>/usr/include/sys/socket.h:218: `int64_t' undeclared here =
(not in a=20
function)<BR>/usr/include/sys/socket.h:218: `u_char' undeclared here =
(not in a=20
function)<BR>/usr/include/sys/socket.h:218: `int64_t' undeclared here =
(not in a=20
function)<BR>/usr/include/sys/socket.h:273: syntax error before=20
`uid_t'<BR>/usr/include/sys/socket.h:278: syntax error before=20
`gid_t'<BR>/usr/include/sys/socket.h:452: syntax error before `u_short'=20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>/usr/include/sys/socket.h:460: syntax =
error before=20
`caddr_t'</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>/usr/include/sys/socket.h</FONT><FONT =
face=3DArial=20
size=3D2>:464: syntax error before `caddr_t'</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>/usr/include/sys/socket.h:485: syntax =
error before=20
`recv' <BR>/usr/include/sys/socket.h:485: syntax error before=20
`size_t'<BR>/usr/include/sys/socket.h:485: warning: data definition has =
no type=20
or storage class <BR>/usr/include/sys/socket.h:486: syntax error before=20
`recvfrom'</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>/usr/include/sys/socket.h:486: syntax =
error before=20
`size_t'</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>/usr/include/sys/socket.h:487: warning: =
data=20
definition has no type or storage class</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>/usr/include/sys/socket.h:488: syntax =
error before=20
`recvmsg'</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>/usr/include/sys/socket.h:488: warning: =
data=20
definition has no type or storage class </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>/usr/include/sys/socket.h:489: syntax =
error before=20
`send' <BR>/usr/include/sys/socket.h:489: syntax error before `size_t'=20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>/usr/include/sys/socket.h:489: warning: =
data=20
definition has no type or storage class </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>/usr/include/sys/socket.h:490: syntax =
error before=20
`sendto' </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>/usr/include/sys/socket.h:491: syntax =
error before=20
`size_t'</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>/usr/include/sys/socket.h:491: warning: =
data=20
definition has no type or storage class </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>/usr/include/sys/socket.h:492: syntax =
error before=20
`sendmsg'</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>/usr/include/sys/socket.h:492: warning: =
data=20
definition has no type or storage class </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>(I used NetBSD 1.5.2 on =
sparc)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>And this is part of =
/usr/include/sys/socket.h=20
around&nbsp;line 186:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>...<BR>/*<BR>&nbsp;* Structure used by =
kernel to=20
store most<BR>&nbsp;* addresses.<BR>&nbsp;*/<BR>struct sockaddr=20
{<BR>&nbsp;u_char&nbsp;sa_len;&nbsp;&nbsp;&nbsp;/* total length=20
*/&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
(&lt;----- this is line =
186&nbsp;)<BR>&nbsp;u_char&nbsp;sa_family;&nbsp;&nbsp;/*=20
address family */<BR>&nbsp;char&nbsp;sa_data[14];&nbsp;&nbsp;/* actually =
longer;=20
address value */<BR>};</DIV>
<DIV>&nbsp;</DIV>
<DIV>#if defined(_KERNEL)<BR>/*<BR>&nbsp;* Structure used by kernel to =
pass=20
protocol<BR>&nbsp;* information in raw sockets.<BR>&nbsp;*/<BR>struct =
sockproto=20
{<BR>&nbsp;u_short&nbsp;sp_family;&nbsp;&nbsp;/* address family=20
*/<BR>&nbsp;u_short&nbsp;sp_protocol;&nbsp;&nbsp;/* protocol =
*/<BR>};<BR>#endif=20
/* _KERNEL */<BR>...</DIV>
<DIV>&nbsp;</DIV>
<DIV>Would you tell me&nbsp;what is wrong (and how to correct it :-) =
pleas ? I'm=20
new user of NetBSD (before I use Linux and Minix) and I don't know what =
to=20
do.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks a lot.</DIV>
<DIV>Honza</DIV>
<DIV></FONT>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_0079_01C18FA6.BC7C7260--