Skip to content

Latest commit

 

History

History
211 lines (140 loc) · 4.74 KB

File metadata and controls

211 lines (140 loc) · 4.74 KB

Windows Guide

Everything you need to set up, build, test, and run the Weather CLI on Windows.
Complete first-time setup takes 5–15 minutes.


Prerequisites

Tools required:

Tool Version Install
MinGW GCC 11 or later choco install mingw
CMake 3.20 or later choco install cmake
libcurl any recent choco install curl

If you don't have Chocolatey, install it first by running this in PowerShell as Administrator:

Set-ExecutionPolicy Bypass -Scope Process -Force
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

Automated setup (one-time, requires Administrator)

scripts\setup-windows.bat

This script installs Chocolatey (if absent), then MinGW GCC, CMake, and libcurl.

Verify installation

g++ --version       # GCC 11 or later
cmake --version     # 3.20 or later
curl --version      # any recent version

Build

Use mingw32-make (ships with MinGW) from the project root:

mingw32-make build

Executable: build\weather_cli.exe

All available targets:

Command What it does
mingw32-make build Debug build (default)
mingw32-make release Optimised release build
mingw32-make test Build and run all unit tests
mingw32-make run CITY=Paris Build and run for a city
mingw32-make clean Delete the build/ directory
mingw32-make help Show all targets

Run

build\weather_cli.exe London
build\weather_cli.exe "New York" --fahrenheit
build\weather_cli.exe Tokyo --extended
build\weather_cli.exe --help

No API key required. The project uses OpenMeteo, which is free and requires no registration.


Tests

mingw32-make test

Expected output:

100% tests passed, 0 tests failed out of 1
All tests passed

Or run the test binary directly:

build\tests\weather_cli_tests.exe

Manual CMake Build

If you prefer to call CMake directly (without the Makefile):

cmake -B build -G "Unix Makefiles" -DCMAKE_CXX_COMPILER=g++ -DCMAKE_MAKE_PROGRAM=mingw32-make -DCMAKE_BUILD_TYPE=Debug
cmake --build build -j 4

VS Code Setup

Required extensions

When you open the project, click Install All for recommended extensions, or install manually:

  • C/C++ (ms-vscode.cpptools) — IntelliSense, debugging
  • CMake Tools (ms-vscode.cmake-tools) — CMake integration
  • CMake (twxs.cmake) — CMake language support

Optional:

  • GitHub Copilot (github.copilot)
  • GitHub Copilot Chat (github.copilot-chat)

Open the project

code .

Or File → Open Folder and select the copilot-cpp directory.

Build from VS Code

Press Ctrl+Shift+B (runs the default CMake build task).

Debug from VS Code

  1. Open src/main.cpp
  2. Click the left margin to set a breakpoint
  3. Press F5 → select Debug Weather CLI (Windows)

Tests in VS Code

Click the Testing icon in the Activity Bar (flask) → click the play button to run all tests.


Troubleshooting

cmake or g++ not found

choco install cmake mingw
refreshenv

Close the terminal, open a new one, then retry.

Build fails — curl not found

choco install curl
mingw32-make clean
mingw32-make build

If curl was upgraded and the version number in the Chocolatey path changed, update the curl path in:

  • CMakeLists.txt (root — set(CURL_ROOT ...))
  • tests/CMakeLists.txt (set(CURL_DLL ...))

Tests hang or fail with missing DLL

The build system copies libcurl-x64.dll automatically to both build/ and build/tests/. If you see a missing DLL error, copy it manually:

copy "C:\ProgramData\chocolatey\lib\curl\tools\curl-8.19.0_1-win64-mingw\bin\libcurl-x64.dll" build\tests\

Permission denied running setup script

Right-click Command Prompt and select Run as administrator, then run scripts\setup-windows.bat.

IntelliSense errors but code compiles

  1. Build first: Ctrl+Shift+B
  2. Ctrl+Shift+PC/C++: Reset IntelliSense Database
  3. Restart VS Code if needed.

Daily Workflow

REM First time only — run as Administrator:
scripts\setup-windows.bat

REM Every day:
mingw32-make build            # build
mingw32-make test             # run tests
mingw32-make run CITY=Tokyo   # run the app
mingw32-make clean            # clean build directory

Related Docs