c++rpc

error: ‘registerrpc’ was not declared in this scope; did you mean ‘register_t’?


I need to create RPC Remote procedure call program in C++ using rpc.h library. The problem is even after I include it, I get error:

error: ‘registerrpc’ was not declared in this scope; did you mean ‘register_t’?

I must use registerrpc function, but I can not use it...

#include <iostream>
#include <netdb.h>
#include <rpc/rpc.h> // included here
#include <rpc/xdr.h>

using namespace std;

int main(int argc, char *argv[]){
    cout << "i work";

    registerrpc(port,1,1,myfunction);

    return 0;
}

Solution

  • This worked for me:

    apt-get install libtirpc-dev

    and then:

    gcc -o server -I /usr/include/tirpc server.cpp -l tirpc