I am a little perplexed here . Not able to make out what could be causing this error :
Code:
1 #include <stdio.h>
2 #include <errno.h>
3 #include <linx.h>
4 #include <linx_socket.h>
5 #include <linx_ioctl.h>
6 #include "linx_basic.sig"
7 #include "linx_basic.h"
8
9 /*
10 * LINX example client
11 */
12
13 int main()
14 {
15 int listen_sd, tran_sd,temp;
16 struct sockaddr_linx server_addr;
17 struct sockaddr_linx client_addr;
18 char buf[10];
19
20 client_addr.family=AF_LINX;
21
22 listen_sd = socket(PF_LINX, SOCK_DGRAM ,0);
23 printf(" listen_sd = %d\n",listen_sd);
24 temp=ioctl(listen_sd,LINX_IOCTL_HUNT,DX1/linx_basic_client);
25 printf("temp =%d\n",temp);
26
27 tran_sd=ioctl(listen_sd,LINX_IOCTL_HUNT,DX2/linx_basic_server);
28 printf("tran_sd = %d\n",tran_sd);
29
30 server_addr.spid=tran_sd;
31 temp=recvfrom(tran_sd,buf,10,0,(struct sockaddr*)&server_addr,sizeof(server_addr));
32 printf("bytes received = %d\n",temp);
33 printf(" %s \n",buf);
34
35 close(tran_sd);
36 close(listen_sd);
37 return 0;
38 }
And these are the error messages that I got :
Code:
Building linx_basic
linx_basic_client.c: In function 'main':
linx_basic_client.c:24: warning: implicit declaration of function 'ioctl'
linx_basic_client.c:24: warning: implicit declaration of function '_IOWR'
linx_basic_client.c:24: error: syntax error before 'struct'
linx_basic_client.c:27: error: syntax error before 'struct'
linx_basic_client.c:31: warning: passing argument 6 of 'recvfrom' makes pointer from integer without a cast
linx_basic_client.c:35: warning: implicit declaration of function 'close'
make: *** [linx_basic] Error 1
I think I have included the "linx_socket.h" and the "linx_ioctl.h" files correctly. I got a lot of errors before i included them in. Though, the first two warnings indicate that something could be wrong there too.
Also, The errors are pointing to line 24 and 27 , but the struct declaration statements are in lines 16 and 17.
Should I post any other relevant info?