我正在尝试使用JavaScript形式访问c ++代码,并且我使用了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 Studio\2017\Community\MSBuild\15.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 Studio\2017\Community\MSBuild\15.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
答案 0 :(得分:1)
GYP是一个元生成系统,可以为您的情况下的各种生成系统MSBuild生成文件。对于您而言,稍后会在MSBuild级别而不是node-gyp级别发生错误。
您正在使用定义了所有这些功能的某些标头,但未链接到相应的*.lib
库或*.c
/ .cpp
源。
您的图书馆似乎是与文档扫描设备有关的专有图书馆。
您可以使用GYP文件的libraries
部分链接到此缺少的库:
'libraries': ['mylibrary.lib']
然后重建MSBuild文件:
node-gyp configure