jeudi 19 septembre 2019

error: ‘Object’ does not name a type - trying to learn NodeJS N-API

Having trouble finding a sufficiently precise answer, basically my compiler (GCC std=c++11) does recognise the type "Object".

Yes, I am fairly new to ++ 

Tried changing command line options, tried Googling for an exact solution. 

If anyone spots any other potential issues, please do let me know. I am finding the NodeJS docs a bit ambiguous in some areas. 

I have included my code and command line output.

Command line snippet:

g++ exampleMod.c -I/usr/include/c++/4.8.5 -I/lhome/psyjw21/node-v10.16.3-linux-x64/include/node -I /usr/include/c++/4.8.5/x86_64-redhat-linux -std=c++11

exampleMod.c:7:1: error: ‘Object’ does not name a type

Object obj = Object::New(env);

The code:

#define NAPI_VERSION 3
#include <node.h>
#include <node_buffer.h>
#include <node_version.h>
#include <node_object_wrap.h>

Object obj = Object::New(env);
obj["foo"] = String::New(env, "bar");

Aucun commentaire:

Enregistrer un commentaire