gpt4 book ai didi

javascript - NodeJS - 无法打开包含文件 : 'unistd.h' :

转载 作者:太空宇宙 更新时间:2023-11-04 00:59:35 27 4
gpt4 key购买 nike

我使用的是 VisualStudio 2012 并在 windows 7 计算机上运行。

我想在我的Windows机器下执行命令make all。为此我安装了Make for Windows

此外,我想编译 Node 库talib .

我打开make文件来由nodeJS本身执行命令。这就是我要运行的命令:

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,我收到几个错误:

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 但是,这给了我相同的结果。

有什么建议我做错了什么吗?

最佳答案

unistd.h是一个UNIX头文件,默认情况下在Windows上找不到。

要么替换unistd.hio.h对于几乎相同的覆盖范围,或使用发现的 GNU windows 端口 here

相关:Is there a replacement for unistd.h for Windows (Visual C)?

编辑:我刚刚用 #include <unistd.h> 编译了模块在文件 src/talib.cpp 中成功注释掉第 31 行

关于javascript - NodeJS - 无法打开包含文件 : 'unistd.h' :,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27629653/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com