【问题标题】:after generate the rpc files and try to compile it i get an conflict error生成 rpc 文件并尝试编译它后,我得到一个冲突错误
【发布时间】:2021-04-06 11:53:48
【问题描述】:

这是我试图弄清楚 rpcgen 的第一天,但​​我不能完全理解 2 件事。首先,我如何能够从过程中返回一个指针。但我的主要问题是为什么我在生成它之后尝试编译它时会出现这个错误。每个信息都会很有用

我确实这样做了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;

【问题讨论】:

  • xdr(和 rpc)没有指针的概念。 rpcgen 可能将其视为矢量类型(您自己已经认出了它)

标签: c rpc sunrpc


【解决方案1】:

名为vectorstruct 出现错误,只要更改名称即可

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-09-20
    • 2012-10-04
    • 2020-02-24
    • 1970-01-01
    • 2014-06-03
    • 2016-03-21
    • 2021-05-21
    相关资源
    最近更新 更多