1

我明白了unresolved external symbol __imp_td_receive。我在 node-gyp 中有错误的 .lib 静态库文件。此外,除了其他功能(来自此标头)之外,我得到相同的错误。我有一个警告LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification [C:\Users\poega\Desktop\node-tg-cli\build\ td_json.vcxproj]

我使用 node-gyp,tdlib windows x32,

td_json_client.h:https ://core.telegram.org/tdlib/docs/td__json__client_8h_source.html

main.cpp 的一部分

// hello.cc
// #include <napi.h>
#include <napi.h>
#include <iostream>
//#include <node.h>
#include "td/telegram/td_json_client.h"

using std::string;

void create_client_id(Napi::CallbackInfo& info) {
      // Isolate* isolate = args.GetIsolate();
      // args.GetReturnValue().Set(String::NewFromUtf8(
      //   isolate, "world").ToLocalChecked());
      td_create_client_id();
  }
  // td_send(int client_id, const char *request)

绑定.gyp

{
    "targets": [
      {
        
        "target_name": "td_json",
        "sources": [ "lib.cc" ],
        "include_dirs": [
          "<!(node -p \"require('node-addon-api').include_dir\")",
          "<(module_root_dir)/td/tdlib/include"
          ],
        'dependencies': [
            "<!(node -p \"require('node-addon-api').gyp\")"
        ],
        "libraries": [
          "<(module_root_dir)/td/tdlib/lib/tdjson_static",
          ],
        'defines': [ 'NAPI_DISABLE_CPP_EXCEPTIONS' ]
      }
    ]
  }

日志

gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli   'C:\\Program Files\\nodejs\\node.exe',
gyp verb cli   'C:\\Users\\poega\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose'
gyp verb cli ]
gyp info using node-gyp@8.4.1
gyp info using node@16.13.1 | win32 | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb find Python Python is not set from command line or npm configuration
gyp verb find Python Python is not set from environment variable PYTHON
gyp verb find Python checking if "python3" can be used
gyp verb find Python - executing "python3" to get executable path
gyp verb find Python - "python3" is not in PATH or produced an error
gyp verb find Python checking if "python" can be used
gyp verb find Python - executing "python" to get executable path
gyp verb find Python - executable path is "C:\Python310\python.exe"
gyp verb find Python - executing "C:\Python310\python.exe" to get version
gyp verb find Python - version is "3.10.1"
gyp info find Python using Python version 3.10.1 found at "C:\Python310\python.exe"
gyp verb get node dir no --target version specified, falling back to host node version: 16.13.1
gyp verb command install [ '16.13.1' ]
gyp verb install input version string "16.13.1"
gyp verb install installing version: 16.13.1
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: 16.13.1
gyp verb build dir attempting to create "build" dir: C:\Users\poega\Desktop\node-tg-cli\build
gyp verb build dir "build" dir needed to be created? Yes
gyp verb find VS msvs_version not set from command line or npm config
gyp verb find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp verb find VS checking VS2019 (16.9.31205.134) found at:
gyp verb find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
gyp verb find VS - found "Visual Studio C++ core features"
gyp verb find VS - found VC++ toolset: v142
gyp verb find VS - found Windows SDK: 10.0.19041.0
gyp info find VS using VS2019 (16.9.31205.134) found at:
gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
gyp info find VS run with --verbose for detailed information
gyp verb build/config.gypi creating config file
gyp verb build/config.gypi writing out config file: C:\Users\poega\Desktop\node-tg-cli\build\config.gypi
gyp verb config.gypi checking for gypi file: C:\Users\poega\Desktop\node-tg-cli\config.gypi
gyp verb common.gypi checking for gypi file: C:\Users\poega\Desktop\node-tg-cli\common.gypi
gyp verb gyp gyp format was not specified; forcing "msvs"
gyp info spawn C:\Python310\python.exe
gyp info spawn args [
gyp info spawn args   'C:\\Users\\poega\\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   '-I',
gyp info spawn args   'C:\\Users\\poega\\Desktop\\node-tg-cli\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\poega\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\poega\\AppData\\Local\\node-gyp\\Cache\\16.13.1\\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\\poega\\AppData\\Local\\node-gyp\\Cache\\16.13.1',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\poega\\AppData\\Roaming\\npm\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\poega\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\16.13.1\\\\<(target_arch)\\\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=C:\\Users\\poega\\Desktop\\node-tg-cli',
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\\poega\\Desktop\\node-tg-cli\\build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp verb command build []
gyp verb build type Release
gyp verb architecture x64
gyp verb node dev dir C:\Users\poega\AppData\Local\node-gyp\Cache\16.13.1
gyp verb found first Solution file build/binding.sln
gyp verb using MSBuild: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe
gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe
gyp info spawn args [
gyp info spawn args   'build/binding.sln',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64'
gyp info spawn args ]
Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
Build started 19.01.2022 14:01:18.
Project "C:\Users\poega\Desktop\node-tg-cli\build\binding.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
  Building solution configuration "Release|x64".
Project "C:\Users\poega\Desktop\node-tg-cli\build\binding.sln" (1) is building "C:\Users\poega\Desktop\node-tg-cli\buil
d\node_modules\node-addon-api\nothing.vcxproj" (2) on node 1 (default targets).
PrepareForBuild:
  Creating directory "Release\obj\nothing\".
  Creating directory "C:\Users\poega\Desktop\node-tg-cli\build\Release\".
  Creating directory "Release\obj\nothing\nothing.tlog\".
InitializeBuildStatus:
  Creating "Release\obj\nothing\nothing.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
MakeDirsForCl:
  Creating directory "C:\Users\poega\Desktop\node-tg-cli\build\node_modules\node-addon-api\Release\obj\nothing\node_mod
  ules\node-addon-api".
ClCompile:
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\HostX64\x64\CL.exe /c /I"
  C:\Users\poega\AppData\Local\node-gyp\Cache\16.13.1\include\node" /I"C:\Users\poega\AppData\Local\node-gyp\Cache\16.1
  3.1\src" /I"C:\Users\poega\AppData\Local\node-gyp\Cache\16.13.1\deps\openssl\config" /I"C:\Users\poega\AppData\Local\
  node-gyp\Cache\16.13.1\deps\openssl\openssl\include" /I"C:\Users\poega\AppData\Local\node-gyp\Cache\16.13.1\deps\uv\i
  nclude" /I"C:\Users\poega\AppData\Local\node-gyp\Cache\16.13.1\deps\zlib" /I"C:\Users\poega\AppData\Local\node-gyp\Ca
  che\16.13.1\deps\v8\include" /Z7 /nologo /W3 /WX- /diagnostics:column /MP /Ox /Ob2 /Oi /Ot /Oy /GL /D NODE_GYP_MODULE
  _NAME=nothing /D USING_UV_SHARED=1 /D USING_V8_SHARED=1 /D V8_DEPRECATION_WARNINGS=1 /D V8_DEPRECATION_WARNINGS /D V8
  _IMMINENT_DEPRECATION_WARNINGS /D _GLIBCXX_USE_CXX11_ABI=1 /D WIN32 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DE
  PRECATE /D _HAS_EXCEPTIONS=0 /D OPENSSL_NO_PINSHARED /D OPENSSL_THREADS /D "HOST_BINARY=\"node.exe\"" /GF /Gm- /MT /G
  S /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR- /Fo"Release\obj\nothing\\node_modules\node-addon-api\nothi
  ng.obj" /Fd"C:\Users\poega\Desktop\node-tg-cli\build\Release\nothing.pdb" /Gd /TC /wd4351 /wd4355 /wd4800 /wd4251 /wd
  4275 /wd4244 /wd4267 /FC /errorReport:queue /Zc:__cplusplus "..\..\..\node_modules\node-addon-api\nothing.c"
  nothing.c
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\HostX64\x64\CL.exe /c /I"
  C:\Users\poega\AppData\Local\node-gyp\Cache\16.13.1\include\node" /I"C:\Users\poega\AppData\Local\node-gyp\Cache\16.1
  3.1\src" /I"C:\Users\poega\AppData\Local\node-gyp\Cache\16.13.1\deps\openssl\config" /I"C:\Users\poega\AppData\Local\
  node-gyp\Cache\16.13.1\deps\openssl\openssl\include" /I"C:\Users\poega\AppData\Local\node-gyp\Cache\16.13.1\deps\uv\i
  nclude" /I"C:\Users\poega\AppData\Local\node-gyp\Cache\16.13.1\deps\zlib" /I"C:\Users\poega\AppData\Local\node-gyp\Ca
  che\16.13.1\deps\v8\include" /Z7 /nologo /W3 /WX- /diagnostics:column /MP /Ox /Ob2 /Oi /Ot /Oy /GL /D NODE_GYP_MODULE
  _NAME=nothing /D USING_UV_SHARED=1 /D USING_V8_SHARED=1 /D V8_DEPRECATION_WARNINGS=1 /D V8_DEPRECATION_WARNINGS /D V8
  _IMMINENT_DEPRECATION_WARNINGS /D _GLIBCXX_USE_CXX11_ABI=1 /D WIN32 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DE
  PRECATE /D _HAS_EXCEPTIONS=0 /D OPENSSL_NO_PINSHARED /D OPENSSL_THREADS /D "HOST_BINARY=\"node.exe\"" /GF /Gm- /MT /G
  S /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR- /Fo"Release\obj\nothing\\" /Fd"C:\Users\poega\Desktop\node
  -tg-cli\build\Release\nothing.pdb" /Gd /TP /wd4351 /wd4355 /wd4800 /wd4251 /wd4275 /wd4244 /wd4267 /FC /errorReport:q
  ueue /Zc:__cplusplus "C:\Users\poega\AppData\Roaming\npm\node_modules\node-gyp\src\win_delay_load_hook.cc"
  win_delay_load_hook.cc
Lib:
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\HostX64\x64\Lib.exe /OUT:
  "C:\Users\poega\Desktop\node-tg-cli\build\Release\nothing.lib" /NOLOGO /MACHINE:X64 /LTCG:INCREMENTAL Release\obj\not
  hing\win_delay_load_hook.obj
  "Release\obj\nothing\\node_modules\node-addon-api\nothing.obj"
  nothing.vcxproj -> C:\Users\poega\Desktop\node-tg-cli\build\Release\\nothing.lib
FinalizeBuildStatus:
  Deleting file "Release\obj\nothing\nothing.tlog\unsuccessfulbuild".
  Touching "Release\obj\nothing\nothing.tlog\nothing.lastbuildstate".
Done Building Project "C:\Users\poega\Desktop\node-tg-cli\build\node_modules\node-addon-api\nothing.vcxproj" (default t
argets).

Project "C:\Users\poega\Desktop\node-tg-cli\build\binding.sln" (1) is building "C:\Users\poega\Desktop\node-tg-cli\buil
d\td_json.vcxproj.metaproj" (3) on node 1 (default targets).
Project "C:\Users\poega\Desktop\node-tg-cli\build\td_json.vcxproj.metaproj" (3) is building "C:\Users\poega\Desktop\nod
e-tg-cli\build\td_json.vcxproj" (4) on node 1 (default targets).
PrepareForBuild:
  Creating directory "Release\obj\td_json\".
  Creating directory "Release\obj\td_json\td_json.tlog\".
InitializeBuildStatus:
  Creating "Release\obj\td_json\td_json.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\HostX64\x64\CL.exe /c /I"
  C:\Users\poega\AppData\Local\node-gyp\Cache\16.13.1\include\node" /I"C:\Users\poega\AppData\Local\node-gyp\Cache\16.1
  3.1\src" /I"C:\Users\poega\AppData\Local\node-gyp\Cache\16.13.1\deps\openssl\config" /I"C:\Users\poega\AppData\Local\
  node-gyp\Cache\16.13.1\deps\openssl\openssl\include" /I"C:\Users\poega\AppData\Local\node-gyp\Cache\16.13.1\deps\uv\i
  nclude" /I"C:\Users\poega\AppData\Local\node-gyp\Cache\16.13.1\deps\zlib" /I"C:\Users\poega\AppData\Local\node-gyp\Ca
  che\16.13.1\deps\v8\include" /I"..\node_modules\node-addon-api" /I"C:\Users\poega\Desktop\node-tg-cli\td\tdlib\includ
  e" /Z7 /nologo /W3 /WX- /diagnostics:column /MP /Ox /Ob2 /Oi /Ot /Oy /GL /D NODE_GYP_MODULE_NAME=td_json /D USING_UV_
  SHARED=1 /D USING_V8_SHARED=1 /D V8_DEPRECATION_WARNINGS=1 /D V8_DEPRECATION_WARNINGS /D V8_IMMINENT_DEPRECATION_WARN
  INGS /D _GLIBCXX_USE_CXX11_ABI=1 /D WIN32 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _HAS_EXCEPTIONS
  =0 /D OPENSSL_NO_PINSHARED /D OPENSSL_THREADS /D NAPI_DISABLE_CPP_EXCEPTIONS /D BUILDING_NODE_EXTENSION /D "HOST_BINA
  RY=\"node.exe\"" /D _WINDLL /GF /Gm- /MT /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR- /Fo"Release\obj
  \td_json\\lib.obj" /Fd"Release\obj\td_json\vc142.pdb" /Gd /TP /wd4351 /wd4355 /wd4800 /wd4251 /wd4275 /wd4244 /wd4267
   /FC /errorReport:queue /Zc:__cplusplus ..\lib.cc
  lib.cc
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\HostX64\x64\CL.exe /c /I"
  C:\Users\poega\AppData\Local\node-gyp\Cache\16.13.1\include\node" /I"C:\Users\poega\AppData\Local\node-gyp\Cache\16.1
  3.1\src" /I"C:\Users\poega\AppData\Local\node-gyp\Cache\16.13.1\deps\openssl\config" /I"C:\Users\poega\AppData\Local\
  node-gyp\Cache\16.13.1\deps\openssl\openssl\include" /I"C:\Users\poega\AppData\Local\node-gyp\Cache\16.13.1\deps\uv\i
  nclude" /I"C:\Users\poega\AppData\Local\node-gyp\Cache\16.13.1\deps\zlib" /I"C:\Users\poega\AppData\Local\node-gyp\Ca
  che\16.13.1\deps\v8\include" /I"..\node_modules\node-addon-api" /I"C:\Users\poega\Desktop\node-tg-cli\td\tdlib\includ
  e" /Z7 /nologo /W3 /WX- /diagnostics:column /MP /Ox /Ob2 /Oi /Ot /Oy /GL /D NODE_GYP_MODULE_NAME=td_json /D USING_UV_
  SHARED=1 /D USING_V8_SHARED=1 /D V8_DEPRECATION_WARNINGS=1 /D V8_DEPRECATION_WARNINGS /D V8_IMMINENT_DEPRECATION_WARN
  INGS /D _GLIBCXX_USE_CXX11_ABI=1 /D WIN32 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _HAS_EXCEPTIONS
  =0 /D OPENSSL_NO_PINSHARED /D OPENSSL_THREADS /D NAPI_DISABLE_CPP_EXCEPTIONS /D BUILDING_NODE_EXTENSION /D "HOST_BINA
  RY=\"node.exe\"" /D _WINDLL /GF /Gm- /MT /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR- /Fo"Release\obj
  \td_json\\" /Fd"Release\obj\td_json\vc142.pdb" /Gd /TP /wd4351 /wd4355 /wd4800 /wd4251 /wd4275 /wd4244 /wd4267 /FC /e
  rrorReport:queue /Zc:__cplusplus "C:\Users\poega\AppData\Roaming\npm\node_modules\node-gyp\src\win_delay_load_hook.cc
  "
  win_delay_load_hook.cc
Link:
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\HostX64\x64\link.exe /ERR
  ORREPORT:QUEUE /OUT:"C:\Users\poega\Desktop\node-tg-cli\build\Release\td_json.node" /INCREMENTAL:NO /NOLOGO kernel32.
  lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.li
  b DelayImp.lib "C:\\Users\\poega\\AppData\\Local\\node-gyp\\Cache\\16.13.1\\x64\\node.lib" "C:\Users\poega\Desktop\no
  de-tg-cli\td\tdlib\lib\tdjson_static.lib" Delayimp.lib /DELAYLOAD:node.exe /MANIFEST /MANIFESTUAC:"level='asInvoker'
  uiAccess='false'" /manifest:embed /DEBUG /PDB:"C:\Users\poega\Desktop\node-tg-cli\build\Release\td_json.pdb" /OPT:REF
   /OPT:ICF /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X64 /LTCG:INCREMENTAL /ignore:4199 /DLL Release\obj\td_json\win_de
  lay_load_hook.obj
  Release\obj\td_json\\lib.obj
  "C:\Users\poega\Desktop\node-tg-cli\build\Release\nothing.lib"
     Creating library C:\Users\poega\Desktop\node-tg-cli\build\Release\td_json.lib and object C:\Users\poega\Desktop\no
  de-tg-cli\build\Release\td_json.exp
lib.obj : error LNK2001: unresolved external symbol td_receive [C:\Users\poega\Desktop\node-tg-cli\build\td_json.vcxpro
j]
lib.obj : error LNK2001: unresolved external symbol td_send [C:\Users\poega\Desktop\node-tg-cli\build\td_json.vcxproj]
lib.obj : error LNK2001: unresolved external symbol td_create_client_id [C:\Users\poega\Desktop\node-tg-cli\build\td_js
on.vcxproj]
lib.obj : error LNK2001: unresolved external symbol td_execute [C:\Users\poega\Desktop\node-tg-cli\build\td_json.vcxpro
j]
C:\Users\poega\Desktop\node-tg-cli\build\Release\td_json.node : fatal error LNK1120: 4 unresolved externals [C:\Users\p
oega\Desktop\node-tg-cli\build\td_json.vcxproj]
Done Building Project "C:\Users\poega\Desktop\node-tg-cli\build\td_json.vcxproj" (default targets) -- FAILED.

Done Building Project "C:\Users\poega\Desktop\node-tg-cli\build\td_json.vcxproj.metaproj" (default targets) -- FAILED.

Done Building Project "C:\Users\poega\Desktop\node-tg-cli\build\binding.sln" (default targets) -- FAILED.


Build FAILED.

"C:\Users\poega\Desktop\node-tg-cli\build\binding.sln" (default target) (1) ->
"C:\Users\poega\Desktop\node-tg-cli\build\td_json.vcxproj.metaproj" (default target) (3) ->
"C:\Users\poega\Desktop\node-tg-cli\build\td_json.vcxproj" (default target) (4) ->
(Link target) ->
  lib.obj : error LNK2001: unresolved external symbol td_receive [C:\Users\poega\Desktop\node-tg-cli\build\td_json.vcxp
roj]
  lib.obj : error LNK2001: unresolved external symbol td_send [C:\Users\poega\Desktop\node-tg-cli\build\td_json.vcxproj
]
  lib.obj : error LNK2001: unresolved external symbol td_create_client_id [C:\Users\poega\Desktop\node-tg-cli\build\td_
json.vcxproj]
  lib.obj : error LNK2001: unresolved external symbol td_execute [C:\Users\poega\Desktop\node-tg-cli\build\td_json.vcxp
roj]
  C:\Users\poega\Desktop\node-tg-cli\build\Release\td_json.node : fatal error LNK1120: 4 unresolved externals [C:\Users
\poega\Desktop\node-tg-cli\build\td_json.vcxproj]

    0 Warning(s)
    5 Error(s)

Time Elapsed 00:00:04.02
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\poega\AppData\Roaming\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
gyp ERR! System Windows_NT 10.0.19044
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\poega\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose"
gyp ERR! cwd C:\Users\poega\Desktop\node-tg-cli
gyp ERR! node -v v16.13.1
gyp ERR! node-gyp -v v8.4.1
gyp ERR! not ok
4

1 回答 1

0
  • 如果您要静态链接库,则需要修复#defines. 查看你的库的头文件,会有某种条件#define控制dllimport/dllexport装饰器的包含。确保它们不会被包含在内 - 只有在构建 DLL 时才需要它们。这就是链接器生成__imp_前缀的原因——这意味着它正在尝试从 DLL 导入。
  • 如果要链接库 DLL,则需要 DLL 和导入.lib库,并且需要.lib在以下libraries部分中添加:
   "conditions": [
     ["OS == 'win'", {
       "libraries": [
         "<path...>/tdjson.lib"
       ]
     }]
   ]
于 2022-01-18T18:39:41.337 回答