go-tdlib
go-tdlib copied to clipboard
gcc and tdlib build on windows ( instruction )
for building and executing on windows it can be a little bit tricky, so I'll post my solution for anyone that wants to run it on windows
step 1: building the tdlib
first, install visual studio and build the binaries using this instruction
if you had any problem in building the tdlib library it can be for one of the below reasons
- wrong visual studio components were installed
- you need a proxy for downloading the dependencies (especially for Iranians)
then copy the directory ( the whole tdlib directory ) into the same drive that you want to execute your app, dont need to be in the exact directory just on the same drive
step 2: Installing GCC
install msys64 for MinGW and GCC
set a new path environment to point to MinGW and its bins
note replace it with your bin folder ( default is this )
C:\msys64\mingw64\bin
step 3: set needed environment variables
set this environment variables
CGO_CFLAGS
-IC:\td\tdlib\include
CGO_LDFLAGS
-LC:\td\tdlib\bin -ltdjson
replace C:\td
with your td installation path
then set td path built bins to your environment paths
C:\td\tdlib\bin
again replace the path with your build directory
after that, you can execute your app and use the go-tdlib library
The command cmake -A x64 -DCMAKE_INSTALL_PREFIX:PATH=../tdlib -DCMAKE_TOOLCHAIN_FILE:FILEPATH=../vcpkg/scripts/buildsystems/vcpkg.cmake ..
in build instruction should be added with -G "Visual Studio 17 2022"
, specifically the parameters should be queried on CMake Generator according to your version of Visual Studio.