这是我第一天试图弄清楚rpcgen,我无法完全理解两件事。首先,如何从过程中返回指针。但我的主要问题是,为什么我在生成后试图编译它时会出现这个错误
我确实执行了rpcgen -a -C proj.x
,然后我将Makefile的一部分更改如下:
CC = gcc
CFLAGS += -g -DRPC_SVC_FG
LDLIBS += -lnsl
RPCGENFLAGS = -C
然后我尝试make
命令
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
项目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;
名为vector
的struct
出现错误,如果您只更改名称,它就会工作