生成 rpc 文件并尝试编译后出现冲突错误

after generate the rpc files and try to compile it i get an conflict error

这是我尝试弄清楚 rpcgen 的第一天,我不太明白两件事。首先,我如何能够 return 来自过程的指针。但我的主要问题是为什么在生成它后尝试编译它时会出现此错误。每一条信息都会有用

我真的这样做 rpcgen -a -C proj.x 然后我改变了 Makefile 的一部分如下:

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

然后我尝试 make 命令

错误:

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;

名为 vectorstruct 出现错误,如果您只更改名称

,它将起作用