invalid use of non-static member function while setting a v8 function

200 views Asked by At

i have used v8 inside a class. Createcontext method is also inside a wrapper class. when i try to set global and map it to print function which is also inside the same class, i am getting error invalid use of non-static member function

the line i used to set the method is

global->Set(v8::String::NewFromUtf8(isolate,"print"), v8::FunctionTemplate::New(isolate,this -> print));

can someone please explain me why this error happens and how to resolve it

1

There are 1 answers

0
user3287256 On

The function you pass to FunctionTemplate::New must be static. Hence try making the print function inside your class static.