1

It's my first day trying to figure out rpcgen and I can't quite understrand 2 things. First of all, how am I able to return a pointer from a procedure. But my main question is why am i getting this error when I try to compile it after I generate it. Every information would be useful

I literally do this rpcgen -a -C proj.x then I change a part of the Makefile as follows:

CC = gcc
CFLAGS += -g -DRPC_SVC_FG
LDLIBS += -lnsl
RPCGENFLAGS = -C

and then I try the make command

Erorr:

gcc -g -DRPC_SVC_FG   -c -o proj_clnt.o proj_clnt.c
In file included from proj_clnt.c:7:
proj.h:81:16: error: conflicting types for ‘xdr_vector’
   81 | extern  bool_t xdr_vector (XDR *, vector*);
      |                ^~~~~~~~~~
In file included from /usr/include/rpc/rpc.h:42,
                 from proj.h:9,
                 from proj_clnt.c:7:
/usr/include/rpc/xdr.h:320:15: note: previous declaration of ‘xdr_vector’ was here
  320 | extern bool_t xdr_vector (XDR *__xdrs, char *__basep, u_int __nelem,
      |               ^~~~~~~~~~
make: *** [<builtin>: proj_clnt.o] Error 1

proj.x

struct vectorR {
    double *vec;
    int n;
};

struct vector {
    int *vec;
    int n;
};

struct aVec {
    int *X;
    int *Y;
    int n;
    double r;
};

struct avg {
    double Ex;
    double Ey;
};

program PROJ_PROG {
        version PROJ_VERS {
                double absolute(vector ) = 1;
                int product(aVec ) = 2;
                avg mean(aVec ) = 3;
                vectorR mulRwXY(aVec ) = 4;
        } = 1;
} = 0x20000000;
4

1 回答 1

0

There was an error with the struct named vector and it will work if you just change the name

于 2021-04-06T13:34:58.653 回答