Native Extension Example

C Chris Child 3 years 6 months ago
1 2 0

Hello,

I'm trying to complete the example for Native Extensions Rhomobile | Building a native extension.

I'm getting the error below and I'm not quite sure why. From googling some have said it is because I have not implemented all the other members of the abstract class but why would it be complaining specifically about the welcome method? Has anyone successfully completed the Greeting example on the Native Extensions page?

Just a note I'm trying to build for Win32 and I get this error.

src\Greeting_impl.cpp(55) : error C2259: 'rho::CGreetingSingleton' : cannot instantiate abstract class due to following members:
        'void rho::IGreetingSingleton::welcome(const rho::String &,rho::apiGenerator::CMethodResult &)' : is abstract

Please Register or Login to post a reply

2 Replies

J Jon Tara

The welcome method is the only method that your example extension has! (Other than standard base methods.)

Did you add an implementation in Greeting_impl.cpp, as shown in the documentation?

You have to add it yourself.

C Chris Child

Yes I have it implemented inside Greeting_impl.cpp.

I have tried the code below which is a straight copy from the docs.

class CGreetingSingleton: public CGreetingSingletonBase
{
    ~CGreetingSingleton(){}
    public:
        void welcome( const rho::String& user, rho::apiGenerator::CMethodResult& oResult) {
            oResult.set("Welcome, "+user);
        }
};

CONTACT
Can’t find what you’re looking for?