我刚刚开始通过 v8 扩展(按照Node.JS 文档和v8 API 文档的说明)编写与 C 库(准确地说是链接语法)的绑定。
我的问题是我收到以下构建错误:
/usr/include/v8.h: In constructor âv8::Handle<T>::Handle(v8::Handle<S>) [with S = v8::FunctionTemplate, T = v8::Value]â:
node.cc:85:68: instantiated from here
/usr/include/v8.h:195:5: error: cannot convert âv8::FunctionTemplate*â to âv8::Value* volatileâ in assignment
...尝试构建以下代码时:
#include <v8.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include "link-includes.h"
using namespace v8;
Dictionary dict;
Parse_Options opts;
static Handle<Value> v8parse(const Arguments& args)
{
/* snip */
}
extern "C" void init (Handle<Object> target)
{
HandleScope scope;
target->Set(String::New("parse"), FunctionTemplate::New(v8parse));
setlocale(LC_ALL, "");
opts = parse_options_create();
dict = dictionary_create_lang("en");
}
我觉得好像我已经遵循了上述链接上的说明,并遵循了它们链接到的示例的模式,但是我得到了上述错误。不是最敏锐的 C++ 编码器,所以很可能这个错误正盯着我看。唉,我不知所措。