Я следую примеру nan, но documention не работает.Ошибка сборки Nan
мой binding.gyp:
{
"targets":[
{
"target_name": "hello",
"sources": ["hello.cpp"],
"include_dirs": [
"<!(node -e \"require('nan')\")"
]
}
]
}
и мой hello.cpp:
#include <nan.h>
using namespace v8;
NAN_METHOD(Method) {
NanScope();
NanReturenValue(String::New("world"));
}
void Init(Handle<Object> exports) {
exports->Set(NanSymbol("hello"), FunctionTemplate::New(Method)->GetFunction());
}
NODE_MODULE(hello, Init)
Это нормально в node-gyp configure
, но когда node-gyp build
, он сообщает об ошибках:
../hello.cpp:10:9: error: use of undeclared identifier 'NanScope'
NanScope();
^
../hello.cpp:11:33: error: no member named 'New' in 'v8::String'
NanReturenValue(String::New("world"));
~~~~~~~~^
../hello.cpp:15:18: error: use of undeclared identifier 'NanSymbol'
exports->Set(NanSymbol("hello"), FunctionTemplate::New(Method)->GetFunction());
^
../hello.cpp:15:60: error: cannot initialize a parameter of type 'v8::Isolate *' with an lvalue of type 'Nan::NAN_METHOD_RETURN_TYPE (Nan::NAN_METHOD_ARGS_TYPE)'
exports->Set(NanSymbol("hello"), FunctionTemplate::New(Method)->GetFunction());
мой версия узла - последняя версия 5.7.0, а node-gyp - последняя версия 3.3.0 nan i последний 2.2.0. Возможно ли, что какой-то код, который я использовал в примере, устарел? Или что мне делать, чтобы заполнить пример hello? Спасибо
У меня такая же проблема. – InsaneRabbit