NodeJS-无法打开包含文件:"unistd.h": [英] NodeJS - Cannot open include file: 'unistd.h':
问题描述
我正在使用VisualStudio 2012
并在windows 7
机器上运行.
I am using VisualStudio 2012
and run on a windows 7
machine.
我想在Windows计算机上执行命令make all
.为此,我安装了 Make for Windows .
I want to execute the command make all
under my windows machine. For this I installed Make for Windows.
此外,我想编译节点库 talib .
Furthermore, I want to compile node library talib.
我打开了make文件,以通过nodeJS本身执行命令.那就是我要运行的命令:
I opened the make file to execute the commands by nodeJS itself. That`s the command I want to run:
cd ./src/lib && node build.js && cd ../../ && node-gyp configure && node-gyp build
第一部分运行良好:
cd ./src/lib && node build.js
但是,运行第二部分cd ../../ && node-gyp configure && node-gyp build
时,我遇到了几个错误:
However, running the second partcd ../../ && node-gyp configure && node-gyp build
, I get several errors:
Kalimini@Kalimini-PC ~/nodeWorkspace/TestProject/node_modules/node-talib-master/sr
c/lib (master)
$ cd ../../ && node-gyp configure && node-gyp build
gyp info it worked if it ends with ok
gyp info using node-gyp@1.0.2
gyp info using node@0.10.25 | win32 | ia32
gyp info spawn python
gyp info spawn args [ 'c:\\Users\\Kalimini\\AppData\\Roaming\\npm\\node_modules\\n
ode-gyp\\gyp\\gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'msvs',
gyp info spawn args '-G',
gyp info spawn args 'msvs_version=auto',
gyp info spawn args '-I',
gyp info spawn args 'c:\\Users\\Kalimini\\nodeWorkspace\\TestProject\\node_mod
ules\\node-talib-master\\build\\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'c:\\Users\\Kalimini\\AppData\\Roaming\\npm\\node_modules\\n
ode-gyp\\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'c:\\Users\\Kalimini\\.node-gyp\\0.10.25\\common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=c:\\Users\\Kalimini\\.node-gyp\\0.10.25',
gyp info spawn args '-Dmodule_root_dir=c:\\Users\\Kalimini\\nodeWorkspace\\CoinA
nalytics\\node_modules\\node-talib-master',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'c:\\Users\\Kalimini\\nodeWorkspace\\TestProject\\node_mod
ules\\node-talib-master\\build',
gyp info spawn args '-Goutput_dir=.' ]
gyp info ok
gyp info it worked if it ends with ok
gyp info using node-gyp@1.0.2
gyp info using node@0.10.25 | win32 | ia32
gyp info spawn C:\Windows\Microsoft.NET\Framework\v4.0.30319\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=Win32' ]
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
talib.cpp
..\src\talib.cpp(31): fatal error C1083: Cannot open include file: 'unistd.h':
No such file or directory [c:\Users\Kalimini\nodeWorkspace\TestProject\node_mod
ules\node-talib-master\build\talib.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (c:\Users\Kalimini\AppData\Roaming\npm\n
ode_modules\node-gyp\lib\build.js:267:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:797:
12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "c:\\Program Files (x86)\\nodejs\\node.exe" "c:\\Users\\Kalimini\
\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "build"
gyp ERR! cwd c:\Users\Kalimini\nodeWorkspace\TestProject\node_modules\node-talib
-master
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok
我也尝试过node-gyp configure --msvs_version=2012
,但是,这给了我相同的结果.
I also tried node-gyp configure --msvs_version=2012
however, this gives me the same result.
任何建议我在做什么错了吗?
Any recommendation what I am doing wrong?
推荐答案
unistd.h 是UNIX头文件,默认情况下在Windows上找不到.
unistd.h is a UNIX header file, not found by default on windows.
要么用io.h
替换unistd.h
以获得几乎相同的覆盖率,要么使用找到的
Either replace unistd.h
with io.h
for almost the same coverage, or use the GNU windows port found here
相关:是否有替代品unistd.h for Windows(Visual C)?
我刚刚在文件src/talib.cpp
第31行中成功注释掉了#include <unistd.h>
的模块,
I just compiled the module with #include <unistd.h>
commented out successfully in file src/talib.cpp
line 31
这篇关于NodeJS-无法打开包含文件:"unistd.h":的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!