I am writing a sample RPC program in C language using RPCGEN tool in my UBUNTU 12.04, when i have finished writing my client and server codes, and when i compile the complete project using a makefile i get error in my server code
i encounter the following errors
gcc -c -o svc_proc.o -g -Wall svc_proc.c
svc_proc.c: In function ‘greetings_1_svc’:
svc_proc.c:4:1: error: number of arguments doesn’t match prototype
helloworld.h:23:15: error: prototype declaration
svc_proc.c:8:2: warning: function returns address of local variable [enabled by default]
make: *** [svc_proc.o] Error 1
The codes of my server and helloworld.h files are
helloworld.h
Expand|Select|Wrap|Line Numbers
- /*
- * Please do not edit this file.
- * It was generated using rpcgen.
- */
- #ifndef _HELLOWORLD_H_RPCGEN
- #define _HELLOWORLD_H_RPCGEN
- #include <rpc/rpc.h>
- #ifdef __cplusplus
- extern "C" {
- #endif
- #define HELLOWORLD 0x2fffffff
- #define HELLOWORLD_V1 1
- #if defined(__STDC__) || defined(__cplusplus)
- #define greetings 1
- extern int * greetings_1(void *, CLIENT *);
- extern int * greetings_1_svc(void *, struct svc_req *);
- extern int helloworld_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
- #else /* K&R C */
- #define greetings 1
- extern int * greetings_1();
- extern int * greetings_1_svc();
- extern int helloworld_1_freeresult ();
- #endif /* K&R C */
- #ifdef __cplusplus
- }
- #endif
- #endif /* !_HELLOWORLD_H_RPCGEN */
Expand|Select|Wrap|Line Numbers
- #include"helloworld.h"
- // This is the SERVER Code
- int* greetings_1_svc()
- {
- int i=0;
- printf("This is your OWN RPC");
- return &i;
- }
Siddarth