Closed osypov closed 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.
@levlam How to link?
@levlam, Also I tried to use tdjson_static.lib, but got same error
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.
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.
@levlam tdjson.lib isn't link?
@levlam I want to use implicit. How I can do it without errors?
What do you mean by "implicit"?
@levlam implicit loading of dll
@levlam I can't understand why this doesn't work. I think I need to link .lib file and use tdjson_client.h file
You need to link against ".dll", which is automatically linked using the corresponding ".lib" file.
@levlam How to do it?
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.
@levlam All conditions are satisfied.
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 warningLINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification
I use td_json_client.h
part of main.cpp
logs