I use node_gyp to compile the code developed by CPP calling the gdal library into a module of node and then call its function in node, but when I run the Times error "cannot find the specified module" I don"t know what went wrong
related codes
/ / binding.gyp file
{
"variables": {
"dll_files":[
"../gdal/bin/gdal203.dll"
]
},
"targets": [
{
"target_name": "addon",
"sources": [
"./CPP_02/tile.cc"
],
"include_dirs": [
"./gdal/include"
],
"libraries": [
"../gdal/lib/gdal_i.lib",
],
}
]
}
/ / tile.cc file
-sharpinclude < node.h >
-sharpinclude < v8.h >
-sharpinclude "gdal_priv.h"
-sharpinclude "ogrsf_frmts.h"
using namespace v8;
void tileload (const FunctionCallbackInfo < Value > & args)
{
Isolate *isolate = args.GetIsolate();
v8::String::Utf8Value s(args[0]);
std::string str(*s);
const char* imagefile = str.c_str();
int x = args[1]->Int32Value();
int y = args[2]->Int32Value();
int l = args[3]->Int32Value();
}
/ / test.js
const addon = require (". / build/Release/addon");
var imagefile = "/ vsicurl/ http://sasmac.oss-cn-beijing.f";
var x = 160;
var y = 83;
var l = 9;
addon.tileload (imagefile, x, y, l);
error prompt
[Running] node "e:cnodetest.js"
module.js:681
return process.dlopen (module, path._makeLong (filename));
^
Error: The specified module could not be found.
\? e:cnodebuildReleaseaddon.node
at Object.Module._extensions..node (module.js:681:18)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (e:\cnode\test.js:1:77)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
[Done] exited with code=1 in 0.96 seconds
Please help me to find out what"s wrong and give me some suggestions on how to correct it