My code is as following: (this is the code for constructor 
AlgorithmOptions_t)

AlgorithmOptions_t(v8::Isolate* isolate, v8::Handle<v8::Object> options_v8) {
   v8::Handle<v8::Value> type_handle = options_v8->Get(
      v8::String::NewFromUtf8(isolate, "type"));
   v8::Handle<v8::Value> max_iteration_handle = options_v8->Get(
      v8::String::NewFromUtf8(isolate, "max_iteration"));
   v8::Handle<v8::Value> tolerance_handle = options_v8->Get(
      v8::String::NewFromUtf8(isolate, "tolerance"));
   v8::Handle<v8::Value> learning_rate_handle = options_v8->Get(
      v8::String::NewFromUtf8(isolate, "learning_rate"));
   //v8::assert(type_handle->IsInteger(), "Expected integer algorithm type");
   //v8::assert(max_iteration_handle->IsInteger(), "Expected integer number of 
iterations");
   
   type = (algorithm_type)type_handle->IntegerValue();
   max_iteration = max_iteration_handle->IntegerValue();
   tolerance = tolerance_handle->NumberValue();
   learning_rate = learning_rate_handle->NumberValue();
}

And the output compiler is as following:
*In constructor ‘AlgorithmOptions_t::AlgorithmOptions_t(v8::Isolate*, 
v8::Handle<v8::Object>)’:*
*/home/haohanwang/CLion/GenAMap_V2/src/algorithm/AlgorithmOptions.hpp:25:4: 
error: ‘NewFromUtf8’ is not a member of ‘v8::String’*
*    v8::String::NewFromUtf8(isolate, "type"));*
*    ^*
*/home/haohanwang/CLion/GenAMap_V2/src/algorithm/AlgorithmOptions.hpp:27:4: 
error: ‘NewFromUtf8’ is not a member of ‘v8::String’*
*    v8::String::NewFromUtf8(isolate, "max_iteration"));*
*    ^*
*/home/haohanwang/CLion/GenAMap_V2/src/algorithm/AlgorithmOptions.hpp:29:4: 
error: ‘NewFromUtf8’ is not a member of ‘v8::String’*
*    v8::String::NewFromUtf8(isolate, "tolerance"));*
*    ^*
*/home/haohanwang/CLion/GenAMap_V2/src/algorithm/AlgorithmOptions.hpp:31:4: 
error: ‘NewFromUtf8’ is not a member of ‘v8::String’*
*    v8::String::NewFromUtf8(isolate, "learning_rate"));*

Yes, I am trying to build an add-on so that I can call my c++ code from 
node. 
Sorry that I am not entirely sure what node-gyp is. I am pretty new to 
node, sorry about that. 

On Sunday, March 20, 2016 at 4:10:12 AM UTC-4, Ben Noordhuis wrote:
>
> On Sat, Mar 19, 2016 at 8:35 PM, Haohan Wang <[email protected] 
> <javascript:>> wrote: 
> > Node version (given by command node -v) is v5.8.0 
> > 
> > v8 version (given by command node -e 'console.log(process.versions.v8);' 
> ) 
> > is 4.6.85.31 
> > 
> > Probably this is the problem then. How should I make them consistent? 
> > I thought once I install node, these files are installed with the same 
> > version, but it seems not this case. And apt-get upgrade seems not 
> working 
> > either. 
> > 
> > Thanks. 
>
> That version of node.js (and V8) is new enough to have 
> v8::String::NewFromUtf8.  Can you post your code and the _exact_ 
> output from your compiler?  Are you building your add-on with 
> node-gyp?  You are building an add-on, aren't you? 
>

-- 
-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to