How do I build XMRig on Windows with Visual Studio?
You can build XMRig on Windows with Visual Studio’s C++ tools, CMake, and XMRig’s Windows dependency package. The simplest route is a 64-bit Release build: CMake prepares the Visual Studio project, and Visual Studio’s compiler turns the source code into xmrig.exe.
1. Install the build tools
Use a 64-bit Windows PC that you own or have permission to use. Install Visual Studio 2022 Community, then select the Desktop development with C++ workload in its installer.
Make sure these components are included:
- MSVC v143 C++ build tools: the compiler that builds your program.
- Windows SDK: Microsoft’s Windows development files.
- C++ CMake tools for Windows: tools that prepare and build the project.
You do not need Visual Studio’s web, mobile, or .NET workloads.
Download the source archive for a tagged release from the official xmrig/xmrig GitHub repository. A tagged release gives you a specific published version rather than changing development code.
Also download the official xmrig/xmrig-deps repository, which contains prebuilt libraries XMRig needs on Windows.
2. Put the files in predictable folders
Extract the downloads so you have:
C:\xmrig\CMakeLists.txt
C:\xmrig-deps\msvc2019\x64\
The dependency folder supplies libraries such as libuv, OpenSSL, and hwloc. These handle background tasks, secure connections, and information about your processor.
Despite its name, the msvc2019 dependency package generally works with Visual Studio 2022 because these Microsoft compiler versions use compatible library formats. If your chosen XMRig release documents a different dependency package, follow that release’s instructions.
Check the folder nesting carefully. Downloaded archives often create an extra folder with a branch or version name. Your source folder must directly contain CMakeLists.txt.
3. Configure and compile XMRig
Open x64 Native Tools Command Prompt for VS 2022 from the Start menu. Run:
cd /d C:\xmrig
cmake -S . -B build ^
-G "Visual Studio 17 2022" ^
-A x64 ^
-DXMRIG_DEPS=C:\xmrig-deps\msvc2019\x64
cmake --build build --config Release --parallel
The first command creates the build project. -A x64 selects a 64-bit executable, and XMRIG_DEPS tells CMake where to find the required libraries.
The second command compiles an optimized Release version. Avoid using a Debug build for mining; it is intended for finding programming errors, not performance.
Your executable should appear here:
C:\xmrig\build\Release\xmrig.exe
If you prefer the Visual Studio interface, open the generated solution in the build folder, select Release and x64, then build the solution.
4. Check the result and fix common errors
Confirm that the executable starts:
C:\xmrig\build\Release\xmrig.exe --version
Common problems include:
- CMake is not recognized: install the CMake component, then reopen the developer command prompt.
- Compiler or SDK is missing: modify your Visual Studio installation.
- A dependency cannot be found: check the dependency path and use the
x64libraries. - Generator or architecture mismatch: delete the generated
buildfolder, then configure again.
Security software may flag mining programs. Verify your source and investigate the warning rather than disabling protection broadly. Compiling does not normally require administrator access.
The bottom line
Install Visual Studio’s C++ tools, unpack the official source and dependencies, then configure and build a 64-bit Release version with CMake. Building creates the program; you still need your own wallet address and mining-pool settings before you start mining.
