INSTALL
Windows installation
Build quickly with xmake, or integrate with MSVC using vcpkg + CMake.
1. Prepare the environment
Install Visual Studio 2022 with “Desktop development with C++”, MySQL Community Server 8 and xmake. The project requires C++20.
PowerShellpowershell
# 1. Install Visual Studio 2022 -> Desktop development with C++
# 2. Install MySQL Community Server 8
# 3. Install xmake (recommended for a quick start)
Invoke-Expression (Invoke-Webrequest 'https://xmake.io/psget.text' -UseBasicParsing).Content2. Option A: xmake (recommended)
The xmake target uses startup/main_dev.cpp and declares dependencies in xmake.lua.
terminalpowershell
cd paozhu
unzip asio.zip
xmake
.\build\windows\x64\release\paozhu.exe3. Option B: vcpkg + CMake
Developer PowerShellpowershell
# From a Visual Studio Developer PowerShell
cmake . -B build ^
-DENABLE_VCPKG=ON ^
-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake ^
-DVCPKG_TARGET_TRIPLET=x64-windows ^
-DCMAKE_BUILD_TYPE=Debug -G Ninja
cmake --build build --config Debug
.\bin\Debug\paozhu.exe4. Common issues
| Symptom | Fix |
|---|---|
| Missing ASAN DLL | CMake tries to copy it automatically; pass -DASAN_DLL_SOURCE="..." if detection fails. |
| Port 80/443 busy | Change httpport/httpsport in conf/server.conf, or run elevated. |
| Generator mismatch | Delete the build directory and reconfigure. |