nwjs / nw-gyp

native addon build tool for node-webkit
MIT License
195 stars 50 forks source link

Can not build module with nw 0.9.x #29

Closed ecdeveloper closed 10 years ago

ecdeveloper commented 10 years ago

The same code which worked fine with node-webkit 0.8.4 now throws errors while building.

../main.cpp:43:31: error: expected class name
class MyClass : node::ObjectWrap {

Also, for a regular method setup to exports it throws an error as well:

Handle<Value> Method(const Arguments& args) {
    HandleScope scope;
    return scope.Close(String::New("Hey there"));
}
...
exports->Set(String::NewSymbol("Method"), FunctionTemplate::New(Method)->GetFunction());

Here is the error:

../main.cpp:300:66: error: cannot initialize a parameter of type 'FunctionCallback' (aka 'void (*)(const FunctionCallbackInfo<v8::Value> &)') with an lvalue of type 'Handle<v8::Value> (const v8::Arguments &)':
      type mismatch at 1st parameter ('const FunctionCallbackInfo<v8::Value> &' vs 'const v8::Arguments &')
        exports->Set(String::NewSymbol("Method"), FunctionTemplate::New(Method)->GetFunction());

Once again, this code works just fine with node-webkit 0.8.4 and older.

rogerwang commented 10 years ago

Does your module compile with Node v0.11?

ecdeveloper commented 10 years ago

Yes. Tried with 0.11.10 - exactly the same errors.

rogerwang commented 10 years ago

Then it's not an issue in node-webkit. There is an API change in Node v0.11 from v0.10. You'll need to update your native module.

btw, this might help: https://github.com/rvagg/nan

ecdeveloper commented 10 years ago

But it actually doesn't work even with the stable v0.10.25. The issue is only with node-webkit v0.9 (no matter which version of node I use). In case of node-webkit v0.8.4 it works with both node versions (0.10 and 0.11). Any hints?

rogerwang commented 10 years ago

node-webkit contains a copy of Node inside of it. It doesn't matter with which version you installed in your system, which nw-gyp reports. That should confused you.

node-webkit v0.9.1 contains Node v0.11.9 and node-webkit v0.8.x contains Node v0.10.x.