Hello,
I have task to make a program that multiplies polynomials as client(input/output indexes)-server(multiplying) using RPC. However when I try to compile it with gcc it gives the next info:
for client:
Udefined first
symbol referenced
Clnt_create client.o
for server:
Udefined first
symbol referenced
mlt_proc_1 mlt_svc.o
What could be done with it?(Some libs problems(?), mb missing some include files?)
here the listings:
mlt.x
struct mlt_in { /* () */
int f[20];
int g[20];
};
struct mlt_out { /* () */
int d[40];
};
program MLT_PROG {
version MLT_VERS {
mlt_out MLTPROC(mlt_in) = 1; /* = 1 */
} = 1;
} = 0x31230000;
client.c
#include "mlt.h" /*rpcgen */
#include <stdio.h>
#include <rpc/rpc.h>
#include <sys/types.h>
CLIENT *Clnt_create(const char *host, unsigned long prognum, unsigned long versnum, const char *protocol);
int
main()
{
int i,j,m,q,r,s;
CLIENT *cl;
mlt_in in;
mlt_out *outp;
cl = Clnt_create("127.0.0.1", MLT_PROG, MLT_VERS, "tcp");
printf("Insert dimension 1\n");
scanf("%i", q);
printf("\nInsert dimension 2\n");
scanf("%i", r);
printf("Insert indexes from 0 to 20");
for(i=0; i<20; i++)
{
scanf("%i", in.f);
printf("%i\t", in.f);
};
printf("Insert indexes from 0 to 20");
for(j=0; j<20; j++)
{
scanf("%i", in.g[j]);
printf("%i\t", in.g[j]);
};
if ((outp = mltproc_1(&in, cl)) == NULL)
printf("error occured");
printf("\n");
for(m=0; m<=(r+q);m++)
{
printf("%i\t", outp->d[m]);
};
exit(0);
}
server.c
#include "mlt.h"
#include <stdio.h>
#include <rpc/rpc.h>
#include <sys/types.h>
mlt_out *
mltproc_l_svc(mlt_in *inp, struct svc_req *rqstp)
{
static mlt_out out;
int k, i;
int s = 40;
for(k=0; k<=s;k++)
{
out.d[k]=0;
for(i=0; i<=k;i++)
{
out.d[k]=inp->f*inp->g[k-i];
};
};
/*out.d[1] = inp->f[19] * inp->g[19];*/
return(&out);
}