4.4 KiB
Build instructions for Windows
- Prepare folder
- Install third party software
- Choose architecture and initialize terminal
- Clone source code and prepare libraries
- Build the project
- Qt Visual Studio Tools
Prepare folder
The build is done in Visual Studio 2026 with 10.0.26100.0 SDK version.
Choose an empty folder for the future build, for example D:\TBuild. It will be named BuildPath in the rest of this document. Create two folders there, BuildPath\ThirdParty and BuildPath\Libraries.
For x86 and x64, use -vcvars_ver=14.44 (v144.4, based on v143 with Windows 7 support). ARM64 uses the modern toolset described below.
Obtain your API credentials
You will require api_id and api_hash to access the Telegram API servers. To learn how to obtain them click here.
Install third party software
- Download Python 3.10 installer from https://www.python.org/downloads/ and install it with adding to PATH.
- Download Git installer from https://git-scm.com/download/win and install it.
Choose architecture and initialize terminal
Before preparing libraries and running build commands, initialize the Visual Studio environment for your target architecture.
The default modern toolset from Visual Studio 2026 (v145) does not support Windows 7, so x86 and x64 builds must use -vcvars_ver=14.44 (v144.4, based on v143 with Windows 7 support).
For win (32-bit):
%comspec% /k "C:\Program Files\Microsoft Visual Studio\18\Community\VC\Auxiliary\Build\vcvars32.bat" -vcvars_ver=14.44
For win64 (64-bit):
%comspec% /k "C:\Program Files\Microsoft Visual Studio\18\Community\VC\Auxiliary\Build\vcvars64.bat" -vcvars_ver=14.44
For winarm (ARM64, on an ARM64 host), initialize the toolset used for the application build, for example:
%comspec% /k "C:\Program Files\Microsoft Visual Studio\18\Community\VC\Auxiliary\Build\vcvarsall.bat" arm64 -vcvars_ver=14.52
MSVC 19.52 before 19.52.37025 generates incorrect ARM64 FFmpeg code (issue #31570). With those versions, dependency preparation automatically selects the 14.51 toolset for FFmpeg alone. Install the 14.51 ARM64 build tools in the same Visual Studio instance; MSVC 19.51.36256 has been verified. Other dependencies and the application keep the terminal's selected toolset. Fixed 19.52 versions build FFmpeg with the selected toolset as well.
Run dependency preparation and accept the FFmpeg rebuild, then rebuild Telegram. The ARM64 FFmpeg cache includes the compiler actually used for FFmpeg, so an existing library built by the affected compiler is not reused automatically. Keep FFmpeg's default non-LTO compilation and use the newer toolset for the final application link when mixing compiler versions.
Run both Clone source code and prepare libraries and Build the project sections in the terminal initialized with one of the commands above.
Clone source code and prepare libraries
In the initialized terminal, go to BuildPath and run
git clone --recursive https://github.com/telegramdesktop/tdesktop.git
tdesktop\Telegram\build\prepare\win.bat
Build the project
Go to BuildPath\tdesktop\Telegram and run (using your api_id and api_hash):
For win (32-bit):
configure.bat -D TDESKTOP_API_ID=YOUR_API_ID -D TDESKTOP_API_HASH=YOUR_API_HASH
For win64 (64-bit):
configure.bat x64 -D TDESKTOP_API_ID=YOUR_API_ID -D TDESKTOP_API_HASH=YOUR_API_HASH
For winarm (ARM64):
configure.bat arm -T version=%VCToolsVersion% -D TDESKTOP_API_ID=YOUR_API_ID -D TDESKTOP_API_HASH=YOUR_API_HASH
- Open BuildPath\tdesktop\out\Telegram.slnx in Visual Studio 2026
- Select Telegram project and press Build > Build Telegram (Debug and Release configurations)
- The result Telegram.exe will be located in D:\TBuild\tdesktop\out\Debug (and Release)
Qt Visual Studio Tools
For better debugging you may want to install Qt Visual Studio Tools:
- Open Extensions -> Manage Extensions
- Go to Online tab
- Search for Qt
- Install Qt Visual Studio Tools extension