簡體   English   中英

生成 rpc 文件並嘗試編譯它后,我得到一個沖突錯誤

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

這是我試圖弄清楚 rpcgen 的第一天,我不能完全理解兩件事。 首先,我如何能夠從過程中返回一個指針。 但我的主要問題是為什么我在生成它之后嘗試編譯它時會出現這個錯誤。 每個信息都會很有用

我確實這樣做了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

項目

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存在錯誤,如果您只是更改名稱,它將起作用

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM