我的问题是这样的:我想实现一个C RPC例子,我一直运行到以下编译器错误:未定义参考svc_create
remote_exec.c: In function ‘main’:
remote_exec.c:13:3: warning: implicit declaration of function ‘svc_create’
remote_exec.o: In function `main':
remote_exec.c:(.text+0x31): undefined reference to `svc_create'
collect2: ld returned 1 exit status
我的代码:
#include <stdio.h>
#include <rpc/rpc.h>
#include "rls.h"
int main(int argc, char* argv[])
{
extern void execute();
const char* nettype = "tcp";
int no_of_handles;
no_of_handles = svc_create(execute, EXECPROG, EXECVERS, nettype);
svc_run();
return 0;
}
我真的不知道如何解决这个问题。手册页和我研究过的所有例子都只是说包含rpc/rpc.h,但它似乎并不奏效。我正在编译
gcc -Wall -c
什么是您的操作系统,以及您要遵循的示例是什么操作系统? – Mat
我使用的是Ubuntu 11.04。这些例子是针对linux。 – Tudor
奇怪的是,我不认为API存在于Linux上(我认为这是Sun RPC)。链接到这个例子? – Mat