tdlib / td

Cross-platform library for building Telegram clients
https://core.telegram.org/tdlib
Boost Software License 1.0
7.07k stars 1.44k forks source link

i got an error while compiling my code with lib #1835

Closed osypov closed 2 years ago

osypov commented 2 years ago

I got unresolved external symbol __imp_td_td_receive. I use tdjson.lib library file. Also, I get the same error except about other function (from this header). And I have one warning LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification

I use td_json_client.h

part of main.cpp

// hello.cc
#include <napi.h>
#include <iostream>
#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)

logs

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 20.01.2022 16:05:28.
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.
CustomBuild:
  Copying C:\Users\poega\Desktop\node-tg-cli/td/build/Release/tdjson.dll to C:\Users\poega\Desktop\node-tg-cli\build\Re
  lease
          1 file(s) copied.
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.lib" Delayimp.lib /DELAYLOAD:node.exe /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAcces
  s='false'" /manifest:embed /DEBUG /PDB:"C:\Users\poega\Desktop\node-tg-cli\build\Release\td_json.pdb" /OPT:REF /OPT:I
  CF /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X64 /LTCG:INCREMENTAL /ignore:4199 /DLL Release\obj\td_json\win_delay_loa
  d_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 __imp_td_receive [C:\Users\poega\Desktop\node-tg-cli\build\td_json.
vcxproj]
lib.obj : error LNK2001: unresolved external symbol __imp_td_send [C:\Users\poega\Desktop\node-tg-cli\build\td_json.vcx
proj]
lib.obj : error LNK2001: unresolved external symbol __imp_td_create_client_id [C:\Users\poega\Desktop\node-tg-cli\build
\td_json.vcxproj]
lib.obj : error LNK2001: unresolved external symbol __imp_td_execute [C:\Users\poega\Desktop\node-tg-cli\build\td_json.
vcxproj]
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 __imp_td_receive [C:\Users\poega\Desktop\node-tg-cli\build\td_jso
n.vcxproj]
  lib.obj : error LNK2001: unresolved external symbol __imp_td_send [C:\Users\poega\Desktop\node-tg-cli\build\td_json.v
cxproj]
  lib.obj : error LNK2001: unresolved external symbol __imp_td_create_client_id [C:\Users\poega\Desktop\node-tg-cli\bui
ld\td_json.vcxproj]
  lib.obj : error LNK2001: unresolved external symbol __imp_td_execute [C:\Users\poega\Desktop\node-tg-cli\build\td_jso
n.vcxproj]
  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:05.03
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
levlam commented 2 years ago

tdjson.lib is an import library for tdjson.dll, not a static library. You need to link with tdjson.dll in runtime.

osypov commented 2 years ago

@levlam How to link?

osypov commented 2 years ago

@levlam, Also I tried to use tdjson_static.lib, but got same error

levlam commented 2 years ago

You need to link with tdjson.dll dynamically.

Alternatively, you can link statically with tdjson_static.lib, but in this case you will need to manually link with all other TDLib static libraries, specifying them in the correct order.

levlam commented 2 years ago

The simplest way to get the correct list of needed static libraries is to use pkg-config: PKG_CONFIG_PATH=build/pkgconfig pkg-config --libs --static tdjson_static

But linking to tdjson.dll should be much simpler.

osypov commented 2 years ago

@levlam tdjson.lib isn't link?

levlam commented 2 years ago

See https://stackoverflow.com/questions/3573475/how-does-the-import-library-work-details.

osypov commented 2 years ago

@levlam I want to use implicit. How I can do it without errors?

levlam commented 2 years ago

What do you mean by "implicit"?

osypov commented 2 years ago

@levlam implicit loading of dll

osypov commented 2 years ago

@levlam I can't understand why this doesn't work. I think I need to link .lib file and use tdjson_client.h file

levlam commented 2 years ago

You need to link against ".dll", which is automatically linked using the corresponding ".lib" file.

osypov commented 2 years ago

@levlam How to do it?

levlam commented 2 years ago

See https://docs.microsoft.com/en-us/cpp/build/linking-an-executable-to-a-dll?redirectedfrom=MSDN&view=msvc-170. You seems to do everything correct.

osypov commented 2 years ago

@levlam All conditions are satisfied.