Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1# Windows / MSVC Build Guide3This guide describes how to build bitcoind, command-line utilities, and GUI on Windows using Microsoft Visual Studio.5For cross-compiling options, please see [`build-windows.md`](./build-windows.md).7## Preparation9### 1. Install Required Dependencies11The first step is to install the required build applications. The instructions below use WinGet to install the applications.13WinGet is available on all supported Windows versions. The applications mentioned can also be installed manually.15#### Visual Studio17This guide relies on using CMake and vcpkg package manager provided with the Visual Studio installation.19Minimum required version: Visual Studio 2026 version 18.3 with the "Desktop development with C++" workload.21To install Visual Studio Community Edition with the necessary components, run:23```powershell24winget install --id Microsoft.VisualStudio.Community --override "--wait --quiet --add Microsoft.VisualStudio.Workload.NativeDesktop --add Microsoft.VisualStudio.Component.Git --includeRecommended"25```27This installs:28- Visual Studio29- The "Desktop development with C++" workload (NativeDesktop)30- Git component32After installation, the commands in this guide should be executed in "Developer PowerShell for VS" or "Developer Command Prompt for VS".33The former is assumed hereinafter.35#### Python37Python is required for running the test suite.39To install Python, run:41```powershell42winget install python343```45### 2. Clone Bitcoin Repository47`git` should already be installed as a component of Visual Studio. If not, download and install [Git for Windows](https://git-scm.com/downloads/win).49Clone the Bitcoin Core repository to a directory. All build scripts and commands will run from this directory.51```powershell52git clone https://github.com/bitcoin/bitcoin.git53```56## Triplets and Presets58The Bitcoin Core project supports the following vcpkg triplets:59- `x64-windows` (both CRT and library linkage is dynamic)60- `x64-windows-static` (both CRT and library linkage is static)62To facilitate build process, the Bitcoin Core project provides presets, which are used in this guide.64Available presets can be listed as follows:65```powershell66cmake --list-presets67```69By default, all presets set `BUILD_GUI` to `ON`.71## Building73CMake will put the resulting object files, libraries, and executables into a dedicated build directory.75In the following instructions, the "Debug" configuration can be specified instead of the "Release" one.77Run `cmake -B build -LH` to see the full list of available options.79### Building with Static Linking with GUI81```powershell82cmake -B build --preset vs2026-static # It might take a while if the vcpkg binary cache is unpopulated or invalidated.83cmake --build build --config Release # Append "-j N" for N parallel jobs.84ctest --test-dir build --build-config Release # Append "-j N" for N parallel tests.85cmake --install build --config Release # Optional.86```88### Building with Dynamic Linking without GUI90```powershell91cmake -B build --preset vs2026 -DBUILD_GUI=OFF # It might take a while if the vcpkg binary cache is unpopulated or invalidated.92cmake --build build --config Release # Append "-j N" for N parallel jobs.93ctest --test-dir build --build-config Release # Append "-j N" for N parallel tests.94```96### vcpkg-specific Issues and Workarounds98vcpkg installation during the configuration step might fail for various reasons unrelated to Bitcoin Core.100If the failure is due to a "Buildtrees path … is too long" error, which is often encountered when building101with `BUILD_GUI=ON` and using the default vcpkg installation provided by Visual Studio, you can102specify a shorter path to store intermediate build files by using103the [`--x-buildtrees-root`](https://learn.microsoft.com/en-us/vcpkg/commands/common-options#buildtrees-root) option:105```powershell106cmake -B build --preset vs2026-static -DVCPKG_INSTALL_OPTIONS="--x-buildtrees-root=C:\vcpkg"107```109If vcpkg installation fails with the message "Paths with embedded space may be handled incorrectly", which110can occur if your local Bitcoin Core repository path contains spaces, you can override the vcpkg install directory111by setting the [`VCPKG_INSTALLED_DIR`](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/users/buildsystems/cmake-integration.md#vcpkg_installed_dir) variable:113```powershell114cmake -B build --preset vs2026-static -DVCPKG_INSTALLED_DIR="C:\path_without_spaces"115```117## Performance Notes119### vcpkg Manifest Default Features121One can skip vcpkg manifest default features to speed up the configuration step.122For example, the following invocation will skip all features except for "wallet" and "tests" and their dependencies:123```powershell124cmake -B build --preset vs2026 -DVCPKG_MANIFEST_NO_DEFAULT_FEATURES=ON -DVCPKG_MANIFEST_FEATURES="wallet;tests" -DBUILD_GUI=OFF -DWITH_ZMQ=OFF125```127Available features are listed in the [`vcpkg.json`](/vcpkg.json) file.129### Antivirus Software131To improve the build process performance, one might add the Bitcoin repository directory to the Microsoft Defender Antivirus exclusions.
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.