node-gyp 构建给出未解决的外部符号错误
node-gyp build gives unresolved external symbol error
我正在尝试访问 C++ 代码形式 javascript 并且我使用了 swig。现在,当我尝试 运行 命令 node-gyp configure build
时,出现以下错误。任何人都可以在这里帮助我并告诉我为什么会这样
C:\Users\UAL\Desktop\DeskoPenta\Code\SwigWithDeskoCode>node-gyp configure build
gyp info it worked if it ends with okQA
gyp info using node-gyp@3.8.0
gyp info using node@10.14.2 | win32 | x64
gyp info spawn C:\Users\UAL\.windows-build-tools\python27\python.exe
gyp info spawn args [ 'C:\Users\UAL\AppData\Roaming\npm\node_modules\node-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=2015',
gyp info spawn args '-I',
gyp info spawn args 'C:\Users\UAL\Desktop\DeskoPenta\Code\SwigWithDeskoCode\build\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\Users\UAL\AppData\Roaming\npm\node_modules\node-gyp\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\Users\UAL\.node-gyp\10.14.2\include\node\common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=C:\Users\UAL\.node-gyp\10.14.2',
gyp info spawn args '-Dnode_gyp_dir=C:\Users\UAL\AppData\Roaming\npm\node_modules\node-gyp',
gyp info spawn args '-Dnode_lib_file=C:\Users\UAL\.node-gyp\10.14.2\<(target_arch)\node.lib',
gyp info spawn args '-Dmodule_root_dir=C:\Users\UAL\Desktop\DeskoPenta\Code\SwigWithDeskoCode',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'C:\Users\UAL\Desktop\DeskoPenta\Code\SwigWithDeskoCode\build',
gyp info spawn args '-Goutput_dir=.' ]
gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio17\Community\MSBuild.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.
Creating library C:\Users\UAL\Desktop\DeskoPenta\Code\SwigWithDeskoCode\build\Release\example.lib and object C:\Us
ers\UAL\Desktop\DeskoPenta\Code\SwigWithDeskoCode\build\Release\example.exp
example.obj : error LNK2001: unresolved external symbol __imp_DMRZGetDocType [C:\Users\UAL\Desktop\DeskoPenta\Code\Swig
WithDeskoCode\build\example.vcxproj]
example.obj : error LNK2001: unresolved external symbol __imp_DMRZGetField [C:\Users\UAL\Desktop\DeskoPenta\Code\SwigWi
thDeskoCode\build\example.vcxproj]
example.obj : error LNK2001: unresolved external symbol __imp_DMRZDestroyHandle [C:\Users\UAL\Desktop\DeskoPenta\Code\S
wigWithDeskoCode\build\example.vcxproj]
example.obj : error LNK2001: unresolved external symbol __imp_DMRZCreateMrzDescriptor [C:\Users\UAL\Desktop\DeskoPenta\
Code\SwigWithDeskoCode\build\example.vcxproj]
example.obj : error LNK2001: unresolved external symbol __imp_DMRZValidateAllChecksums [C:\Users\UAL\Desktop\DeskoPenta
\Code\SwigWithDeskoCode\build\example.vcxproj]
example.obj : error LNK2001: unresolved external symbol __imp_DMRZParseMrz [C:\Users\UAL\Desktop\DeskoPenta\Code\SwigWi
thDeskoCode\build\example.vcxproj]
example.obj : error LNK2001: unresolved external symbol __imp_ConnectToDevice [C:\Users\UAL\Desktop\DeskoPenta\Code\Swi
gWithDeskoCode\build\example.vcxproj]
example.obj : error LNK2001: unresolved external symbol __imp_PrepareBmpClippedDocumentImage [C:\Users\UAL\Desktop\Desk
oPenta\Code\SwigWithDeskoCode\build\example.vcxproj]
example.obj : error LNK2001: unresolved external symbol __imp_GetPropertyString [C:\Users\UAL\Desktop\DeskoPenta\Code\S
wigWithDeskoCode\build\example.vcxproj]
example.obj : error LNK2001: unresolved external symbol __imp_SetupOnDevicePlugCallback [C:\Users\UAL\Desktop\DeskoPent
a\Code\SwigWithDeskoCode\build\example.vcxproj]
example.obj : error LNK2001: unresolved external symbol __imp_GetMsrOutput [C:\Users\UAL\Desktop\DeskoPenta\Code\SwigWi
thDeskoCode\build\example.vcxproj]
example.obj : error LNK2001: unresolved external symbol __imp_SetupOnOcrCallback [C:\Users\UAL\Desktop\DeskoPenta\Code\
SwigWithDeskoCode\build\example.vcxproj]
example.obj : error LNK2001: unresolved external symbol __imp_UseBuzzer [C:\Users\UAL\Desktop\DeskoPenta\Code\SwigWithD
eskoCode\build\example.vcxproj]
example_wrap.obj : error LNK2001: unresolved external symbol __imp_GetBuzzerSettings2 [C:\Users\UAL\Desktop\DeskoPenta\
Code\SwigWithDeskoCode\build\example.vcxproj]
C:\Users\UAL\Desktop\DeskoPenta\Code\SwigWithDeskoCode\build\Release\example.node : fatal error LNK1120: 134 unresolved
externals [C:\Users\UAL\Desktop\DeskoPenta\Code\SwigWithDeskoCode\build\example.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio17\Community\MSBuild.0\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\UAL\AppData\Roaming\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\UAL\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js" "configure" "build"
gyp ERR! cwd C:\Users\UAL\Desktop\DeskoPenta\Code\SwigWithDeskoCode
gyp ERR! node -v v10.14.2
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
GYP 是一个 meta-build 系统,它为各种构建系统生成文件,在您的情况下为 MSBuild。在您的情况下,稍后会在 MSBuild 级别发生错误,而不是 node-gyp 级别。
您正在使用某些 headers,其中定义了所有这些函数,但未针对相应的 *.lib
库或 *.c
/.cpp
linking来源。
您的库似乎是与文档扫描设备相关的专有库。
您可以 link 通过使用 GYP 文件的 libraries
部分来修复这个丢失的库:
'libraries': ['mylibrary.lib']
然后重建 MSBuild 文件:
node-gyp configure
我正在尝试访问 C++ 代码形式 javascript 并且我使用了 swig。现在,当我尝试 运行 命令 node-gyp configure build
时,出现以下错误。任何人都可以在这里帮助我并告诉我为什么会这样
C:\Users\UAL\Desktop\DeskoPenta\Code\SwigWithDeskoCode>node-gyp configure build
gyp info it worked if it ends with okQA
gyp info using node-gyp@3.8.0
gyp info using node@10.14.2 | win32 | x64
gyp info spawn C:\Users\UAL\.windows-build-tools\python27\python.exe
gyp info spawn args [ 'C:\Users\UAL\AppData\Roaming\npm\node_modules\node-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=2015',
gyp info spawn args '-I',
gyp info spawn args 'C:\Users\UAL\Desktop\DeskoPenta\Code\SwigWithDeskoCode\build\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\Users\UAL\AppData\Roaming\npm\node_modules\node-gyp\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\Users\UAL\.node-gyp\10.14.2\include\node\common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=C:\Users\UAL\.node-gyp\10.14.2',
gyp info spawn args '-Dnode_gyp_dir=C:\Users\UAL\AppData\Roaming\npm\node_modules\node-gyp',
gyp info spawn args '-Dnode_lib_file=C:\Users\UAL\.node-gyp\10.14.2\<(target_arch)\node.lib',
gyp info spawn args '-Dmodule_root_dir=C:\Users\UAL\Desktop\DeskoPenta\Code\SwigWithDeskoCode',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'C:\Users\UAL\Desktop\DeskoPenta\Code\SwigWithDeskoCode\build',
gyp info spawn args '-Goutput_dir=.' ]
gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio17\Community\MSBuild.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.
Creating library C:\Users\UAL\Desktop\DeskoPenta\Code\SwigWithDeskoCode\build\Release\example.lib and object C:\Us
ers\UAL\Desktop\DeskoPenta\Code\SwigWithDeskoCode\build\Release\example.exp
example.obj : error LNK2001: unresolved external symbol __imp_DMRZGetDocType [C:\Users\UAL\Desktop\DeskoPenta\Code\Swig
WithDeskoCode\build\example.vcxproj]
example.obj : error LNK2001: unresolved external symbol __imp_DMRZGetField [C:\Users\UAL\Desktop\DeskoPenta\Code\SwigWi
thDeskoCode\build\example.vcxproj]
example.obj : error LNK2001: unresolved external symbol __imp_DMRZDestroyHandle [C:\Users\UAL\Desktop\DeskoPenta\Code\S
wigWithDeskoCode\build\example.vcxproj]
example.obj : error LNK2001: unresolved external symbol __imp_DMRZCreateMrzDescriptor [C:\Users\UAL\Desktop\DeskoPenta\
Code\SwigWithDeskoCode\build\example.vcxproj]
example.obj : error LNK2001: unresolved external symbol __imp_DMRZValidateAllChecksums [C:\Users\UAL\Desktop\DeskoPenta
\Code\SwigWithDeskoCode\build\example.vcxproj]
example.obj : error LNK2001: unresolved external symbol __imp_DMRZParseMrz [C:\Users\UAL\Desktop\DeskoPenta\Code\SwigWi
thDeskoCode\build\example.vcxproj]
example.obj : error LNK2001: unresolved external symbol __imp_ConnectToDevice [C:\Users\UAL\Desktop\DeskoPenta\Code\Swi
gWithDeskoCode\build\example.vcxproj]
example.obj : error LNK2001: unresolved external symbol __imp_PrepareBmpClippedDocumentImage [C:\Users\UAL\Desktop\Desk
oPenta\Code\SwigWithDeskoCode\build\example.vcxproj]
example.obj : error LNK2001: unresolved external symbol __imp_GetPropertyString [C:\Users\UAL\Desktop\DeskoPenta\Code\S
wigWithDeskoCode\build\example.vcxproj]
example.obj : error LNK2001: unresolved external symbol __imp_SetupOnDevicePlugCallback [C:\Users\UAL\Desktop\DeskoPent
a\Code\SwigWithDeskoCode\build\example.vcxproj]
example.obj : error LNK2001: unresolved external symbol __imp_GetMsrOutput [C:\Users\UAL\Desktop\DeskoPenta\Code\SwigWi
thDeskoCode\build\example.vcxproj]
example.obj : error LNK2001: unresolved external symbol __imp_SetupOnOcrCallback [C:\Users\UAL\Desktop\DeskoPenta\Code\
SwigWithDeskoCode\build\example.vcxproj]
example.obj : error LNK2001: unresolved external symbol __imp_UseBuzzer [C:\Users\UAL\Desktop\DeskoPenta\Code\SwigWithD
eskoCode\build\example.vcxproj]
example_wrap.obj : error LNK2001: unresolved external symbol __imp_GetBuzzerSettings2 [C:\Users\UAL\Desktop\DeskoPenta\
Code\SwigWithDeskoCode\build\example.vcxproj]
C:\Users\UAL\Desktop\DeskoPenta\Code\SwigWithDeskoCode\build\Release\example.node : fatal error LNK1120: 134 unresolved
externals [C:\Users\UAL\Desktop\DeskoPenta\Code\SwigWithDeskoCode\build\example.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio17\Community\MSBuild.0\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\UAL\AppData\Roaming\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\UAL\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js" "configure" "build"
gyp ERR! cwd C:\Users\UAL\Desktop\DeskoPenta\Code\SwigWithDeskoCode
gyp ERR! node -v v10.14.2
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
GYP 是一个 meta-build 系统,它为各种构建系统生成文件,在您的情况下为 MSBuild。在您的情况下,稍后会在 MSBuild 级别发生错误,而不是 node-gyp 级别。
您正在使用某些 headers,其中定义了所有这些函数,但未针对相应的 *.lib
库或 *.c
/.cpp
linking来源。
您的库似乎是与文档扫描设备相关的专有库。
您可以 link 通过使用 GYP 文件的 libraries
部分来修复这个丢失的库:
'libraries': ['mylibrary.lib']
然后重建 MSBuild 文件:
node-gyp configure