【问题标题】:Node JS with C++ integration与 C++ 集成的 Node JS
【发布时间】:2016-07-20 08:46:20
【问题描述】:

我是 Node JS 的新手,只是设置了将 Node JS 与 C++ 集成的环境。 我正在尝试使用 SWIG 由 enobayram 提供的 Node JS - C++ Integration 中提到的示例。 但是,当我尝试使用 node-gyp build 时,它会抛出很多错误。

我的环境

操作系统:Windows 7 Professional x64
Python:2.7.11
节点:v4.4.1
节点 Gyp:v3.3.1
MS VS:MS Visual Studio 社区 2015

D:\Example>node-gyp build
gyp info it worked if it ends with ok
gyp info using node-gyp@3.3.1
gyp info using node@4.4.1 | win32 | x64
gyp info spawn C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args   '/clp:Verbosity=minimal',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64' ]
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  mylib_wrap.cxx
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(614): error C2061: syntax error: identifier 'uint16_t' [D:\Example\build\mylib.vcxproj]
  c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(642): note: see reference to class template instantiation 'v8::PersistentBase<T>' being compiled
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(620): error C3646: 'WrapperClassId': unknown override specifier [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(620): error C2059: syntax error: ')' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(620): error C2238: unexpected token(s) preceding ';' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(1149): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(1149): error C2143: syntax error: missing ',' before '*' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(1154): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(1154): error C2143: syntax error: missing ';' before '*' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(1154): error C2238: unexpected token(s) preceding ';' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(1228): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(1228): error C2143: syntax error: missing ',' before '*' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(1384): error C3646: 'CachedDataVersionTag': unknown override specifier [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(1384): error C2059: syntax error: ')' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(1384): error C2238: unexpected token(s) preceding ';' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(1143): error C2789: 'v8::ScriptCompiler::CachedData::uint8_t': an object of const-qualified type must be initialized [D:\Example\build\mylib.vcxproj]
  c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(1154): note: see declaration of 'v8::ScriptCompiler::CachedData::uint8_t'
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(1143): error C2614: 'v8::ScriptCompiler::CachedData': illegal member initialization: 'data' is not a base or member [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(1536): error C2061: syntax error: identifier 'uint32_t' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2003): error C2065: 'int64_t': undeclared identifier [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2003): error C2923: 'v8::Maybe': 'int64_t' is not a valid template type argument for parameter 'T' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2005): error C2065: 'uint32_t': undeclared identifier [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2005): error C2923: 'v8::Maybe': 'uint32_t' is not a valid template type argument for parameter 'T' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2007): error C2065: 'int32_t': undeclared identifier [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2007): error C2923: 'v8::Maybe': 'int32_t' is not a valid template type argument for parameter 'T' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2011): error C3646: 'IntegerValue': unknown override specifier [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2011): error C2059: syntax error: '(' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2011): error C2238: unexpected token(s) preceding ';' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2012): error C3646: 'Uint32Value': unknown override specifier [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2012): error C2059: syntax error: '(' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2012): error C2238: unexpected token(s) preceding ';' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2013): error C3646: 'Int32Value': unknown override specifier [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2013): error C2059: syntax error: '(' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2013): error C2238: unexpected token(s) preceding ';' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2151): error C2061: syntax error: identifier 'uint16_t' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2156): error C2061: syntax error: identifier 'uint8_t' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2222): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2222): error C2143: syntax error: missing ';' before '*' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2222): error C2433: 'v8::String::ExternalStringResource::uint16_t': 'virtual' not permitted on data declarations [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2222): error C2238: unexpected token(s) preceding ';' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2305): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2301): error C2143: syntax error: missing ',' before '*' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2310): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2310): error C2143: syntax error: missing ',' before '*' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2311): error C2556: 'v8::MaybeLocal<v8::String> v8::String::NewFromOneByte(v8::Isolate *,const int)': overloaded function differs only by return type from 'v8::Local<v8::String> v8::String::NewFromOneByte(v8::Isolate *,const int)' [D:\Example\build\mylib.vcxproj]
  c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2305): note: see declaration of 'v8::String::NewFromOneByte'
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2311): error C2371: 'v8::String::NewFromOneByte': redefinition; different basic types [D:\Example\build\mylib.vcxproj]
  c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2305): note: see declaration of 'v8::String::NewFromOneByte'
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2318): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2314): error C2143: syntax error: missing ',' before '*' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2323): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2323): error C2143: syntax error: missing ',' before '*' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2324): error C2556: 'v8::MaybeLocal<v8::String> v8::String::NewFromTwoByte(v8::Isolate *,const int)': overloaded function differs only by return type from 'v8::Local<v8::String> v8::String::NewFromTwoByte(v8::Isolate *,const int)' [D:\Example\build\mylib.vcxproj]
  c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2318): note: see declaration of 'v8::String::NewFromTwoByte'
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2324): error C2371: 'v8::String::NewFromTwoByte': redefinition; different basic types [D:\Example\build\mylib.vcxproj]
  c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2318): note: see declaration of 'v8::String::NewFromTwoByte'
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2422): error C2143: syntax error: missing ';' before '*' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2422): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2422): error C2334: unexpected token(s) preceding '{'; skipping apparent function body [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2423): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2423): error C2143: syntax error: missing ';' before '*' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2423): error C2334: unexpected token(s) preceding '{'; skipping apparent function body [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2426): error C2143: syntax error: missing ';' before '*' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2426): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2426): error C2238: unexpected token(s) preceding ';' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2230): error C2789: 'v8::String::ExternalStringResource::uint16_t': an object of const-qualified type must be initialized [D:\Example\build\mylib.vcxproj]
  c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2222): note: see declaration of 'v8::String::ExternalStringResource::uint16_t'
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2499): error C2061: syntax error: identifier 'int32_t' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2500): error C2061: syntax error: identifier 'uint32_t' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2501): error C3646: 'Value': unknown override specifier [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2501): error C2059: syntax error: '(' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2501): error C2238: unexpected token(s) preceding ';' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2514): error C3646: 'Value': unknown override specifier [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2514): error C2059: syntax error: '(' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2514): error C2238: unexpected token(s) preceding ';' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2528): error C3646: 'Value': unknown override specifier [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2528): error C2059: syntax error: '(' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2528): error C2238: unexpected token(s) preceding ';' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2595): error C2061: syntax error: identifier 'uint32_t' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2596): error C2061: syntax error: identifier 'uint32_t' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2610): error C2061: syntax error: identifier 'uint32_t' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2643): error C2061: syntax error: identifier 'uint32_t' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2645): error C2061: syntax error: identifier 'uint32_t' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2673): error C2061: syntax error: identifier 'uint32_t' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2674): error C2061: syntax error: identifier 'uint32_t' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2676): error C2061: syntax error: identifier 'uint32_t' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2678): error C2061: syntax error: identifier 'uint32_t' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2808): error C2061: syntax error: identifier 'uint32_t' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2810): error C2061: syntax error: identifier 'uint32_t' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2950): error C3646: 'Length': unknown override specifier [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2950): error C2059: syntax error: '(' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2950): error C2238: unexpected token(s) preceding ';' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2957): error C2061: syntax error: identifier 'uint32_t' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(2959): error C2061: syntax error: identifier 'uint32_t' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(3075): error C2061: syntax error: identifier 'int32_t' [D:\Example\build\mylib.vcxproj]
  c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(3098): note: see reference to class template instantiation 'v8::ReturnValue<T>' being compiled
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(3076): error C2061: syntax error: identifier 'uint32_t' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(3076): error C2535: 'void v8::ReturnValue<T>::Set(void)': member function already defined or declared [D:\Example\build\mylib.vcxproj]
  c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(3075): note: see declaration of 'v8::ReturnValue<T>::Set'
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(4178): error C2065: 'uint32_t': undeclared identifier [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(4178): error C2146: syntax error: missing ')' before identifier 'index' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(4187): error C2065: 'uint32_t': undeclared identifier [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(4187): error C2146: syntax error: missing ')' before identifier 'index' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(4197): error C2065: 'uint32_t': undeclared identifier [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(4197): error C2146: syntax error: missing ')' before identifier 'index' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(4207): error C2065: 'uint32_t': undeclared identifier [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(4207): error C2146: syntax error: missing ')' before identifier 'index' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(4246): error C2061: syntax error: identifier 'uint32_t' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(4477): error C2061: syntax error: identifier 'IndexedPropertyGetterCallback' [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(4494): error C3646: 'getter': unknown override specifier [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(4494): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(4495): error C3646: 'setter': unknown override specifier [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(4495): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(4496): error C3646: 'query': unknown override specifier [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(4496): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(4497): error C3646: 'deleter': unknown override specifier [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(4497): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(4477): error C2065: 'getter': undeclared identifier [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(4487): error C2065: 'setter': undeclared identifier [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(4488): error C2065: 'query': undeclared identifier [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(4489): error C2065: 'deleter': undeclared identifier [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(4492): error C2614: 'v8::IndexedPropertyHandlerConfiguration': illegal member initialization: 'getter' is not a base or member [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(4492): error C2614: 'v8::IndexedPropertyHandlerConfiguration': illegal member initialization: 'setter' is not a base or member [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(4492): error C2614: 'v8::IndexedPropertyHandlerConfiguration': illegal member initialization: 'query' is not a base or member [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(4492): error C2614: 'v8::IndexedPropertyHandlerConfiguration': illegal member initialization: 'deleter' is not a base or member [D:\Example\build\mylib.vcxproj]
c:\users\rtv\.node-gyp\4.4.1\include\node\v8.h(4492): fatal error C1003: error count exceeds 100; stopping compilation [D:\Example\build\mylib.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\rtv\AppData\Roaming\npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\rtv\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "build"
gyp ERR! cwd D:\Example
gyp ERR! node -v v4.4.1
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok

D:\Example>

请求您的帮助以解决此问题。
仅供参考,我尝试安装不同版本的 MS VS,仍然存在类似问题。

【问题讨论】:

  • 感谢 @Keith 将 CPP 更正为 C++。
  • 更新::: 由于我被困在这里,我尝试在 Linux 中进行。所以在 Virtual Box 中安装了 ubuntu 14.04。现在我可以使用 node-gyp 在 linux 中配置和构建,但是当使用 node 中的文件时,它说模块不是自注册的。
  • 这可能不是您要寻找的答案,但有时我没有为语言之间的连接而苦苦挣扎,而是选择设置一个简单的 TCP 协议或使用 zeromq 或类似的东西。跨度>

标签: javascript c++ node.js swig node-gyp


【解决方案1】:

如果这是您第一次尝试 C++ 和 Node.js 集成,您可能会发现从 Node.js C/C++ Addons documentation 开始最简单。

第一个“Hello Word”示例非常适合熟悉 Node 的 C++ 要求。

在最好的情况下,集成 Node.js 和 C++ 的过程可能很棘手。不同版本的 Node.js 的实现发生了变化,您会在网上找到很多不适用于当前版本的 Node 的示例。

【讨论】:

    猜你喜欢
    • 2021-11-25
    • 2015-11-02
    • 2018-04-22
    • 2015-06-14
    • 1970-01-01
    • 1970-01-01
    • 2017-10-31
    • 1970-01-01
    • 2020-01-29
    相关资源
    最近更新 更多