Skip to content

gcc and tdlib build on windows ( instruction )  #106

Description

@Zoha

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

build 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

Activity

  1. changed the title [-]build and gcc on windows ( instruction ) [/-] [+]gcc and tdlib build on windows ( instruction ) [/+] on Oct 19, 2022
  2. WCY-dt commented on May 14, 2024

    @WCY-dt

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions