Skip to content

Commit 6bcf5db

Browse files
authored
docs+ci: 本地使用优化 + 平台矩阵拆分(linux/macos/win10/win11/win 无 MSVC STL) (#89)
* docs+ci: 本地上手三步走 + 平台矩阵拆分(linux/macos/win10/win11/win 无 MSVC STL) README(三语 + book 两语)重写「本地练习环境」段,改成明确的三步: 1. 装工具 —— `xlings install d2x mcpp -y`,两个工具名都链到各自仓库 2. 取课程并验证环境 —— 默认 `d2x install d2mcpp` → `cd d2mcpp` → `mcpp test`; clone 源码那条路收进 <details>,作为可选项而不是与默认路径并列的「二选一」 3. 开始练习 —— `d2x checker` / `d2x status` 第 2 步把 `mcpp test` 摆到台面上是有意的:练习就是测试,新环境跑一遍 「全部不通过」既是练习的起点,也已经证明工具链是通的。 CI 从单个 ubuntu job 拆成五档平台矩阵,每档都跑完整两层验证: linux / macos / windows-10 线(windows-2022)/ windows-11 线(windows-2025) / windows 且无 MSVC STL 最后一档把 runner 上的 Visual Studio 藏掉(改名 vswhere.exe 与 VC 目录 + 清空 VS* 环境变量,并就地检查后置条件),模拟学习者的干净 Windows —— 这 才是多数人的机器。mcpp 应当自动回落到自带的 winlibs MinGW,产物 target 目录名(x86_64-windows-gnu)就是断言依据。 两层验证: - `mcpp test`(已有 e2e.sh)—— pristine 全不过 + 覆盖答案后全过 - `d2x checker`(新增 checker-e2e.sh)—— 答案就位后 checker 必须自己走完 52 道题并退 0 加第二层是因为 checker 在 mcpp test 之上还叠了 Provider 的 NDJSON 协议、 进度持久化、文件监听三层;这三层断掉时 mcpp test 照样全绿,Windows 上就 出过这种静默回归(#87)。checker-e2e.sh 的看门狗自己用 shell 轮询实现, 不依赖 timeout(1)(macOS 默认没有)。 顺带: - .xlings.json pin 上抬 —— mcpp 2026.8.1.1 → 2026.8.2.1(裸 Windows 自动 回落 MinGW 是这个版本才有的能力,无 MSVC STL 那一档依赖它), d2x 2026.08.02.1 → 2026.08.02.2 - 修复文件名核对 job:它还在按迁移前的布局找 `intro/tests cpp*/tests`, 练习早已搬进 src/,于是一个文件都没扫到、永远绿。现在真的核对 52 对。 - 工作流触发路径补上 .xlings.json 本地已验:e2e.sh all(zh/en 各 52/52)、checker-e2e.sh zh 与 en 均全过。 * docs(book): chapter_1 补上工具安装与环境验证,与 README 三步对齐 chapter_1 是三份 README 的「更多细节」落点,但它的 §0 只装 xlings, 接着就直接 `d2x install d2mcpp` —— 一台干净的机器照着做会在第二条命令 上失败,因为 d2x 这个二进制根本还没装。 补两处,与 README 新的三步保持同一套说法: - §0 结尾加 `xlings install d2x mcpp -y`,两个工具名链到各自仓库 - §1 加「验证环境」小节:`cd d2mcpp` + `mcpp test`,并说明「刚拿到课程 时全部未通过」既是起点也是工具链已通的证据 * docs: 改掉 step 2 里「每道练习都能编译并运行」这句错话 原话把 `mcpp test` 说成「验证每道练习都能编译并运行」,正好说反了:练习发 下来就是没做完的,`std:endl`、`D2X_YOUR_ANSWER` 这类东西**必然编不过**, pristine 状态下 0 passed 才是对的(e2e.sh 的断言 1 就是在守这条)。 顺带澄清一个容易误会的点:`solutions/` 不是工作区成员(mcpp.toml 的 members 里没有它),`mcpp test` 从头到尾不碰它。要它变绿得先覆盖到练习 文件上——那是 CI 的动作,不是学习者跑一条命令就会发生的事。 改成说清楚它到底验了什么:工具链解析成功、d2x 库编译通过、运行器逐题都 跑到了;练习本身红着是设计如此。README 三语 + book 两语 + chapter_1 两语 共 7 处同步。 * feat(solutions): 参考答案自己成为一个 mcpp 工程,`mcpp test -p solutions` 直接跑 在此之前 solutions/ 只是一堆躺在磁盘上的 .cpp:不是工作区成员,mcpp 从头到 尾不认识它。想验证答案对不对,唯一的办法是把 52 个文件覆盖到 src/*/tests/ 上、跑一遍、再 git 还原 —— 一套带副作用、要求工作树干净、只有 CI 脚本会用 的流程。学习者或贡献者想确认「答案是好的」,没有一条命令可以跑。 现在 solutions/ 是一个正经工程: solutions/mcpp.toml name=solutions, c++23, 依赖 d2x solutions/tests/<std>/... 52 份答案,就是它的测试 于是: mcpp test -p solutions # 52 passed; 0 failed mcpp test -p solutions cpp11 # 按子串筛 零副作用、不碰练习目录、任何人随手可跑。布局与练习一一对应,测试名 (intro/hello-mcpp、cpp11/00-auto-and-decltype/0) 直接对回练习文件。 配置刻意与练习工程一致(c++23 + d2x),否则「答案能过」推不出「答案放进 练习里也能过」。 覆盖-还原那套 e2e 保留 —— 它验的是另一件事:答案放到练习的位置上也成立, 且练习在未完成时确实不通过。两条互补:新的这条挂了说明答案本身是错的, 旧的那条挂了说明答案与练习对不上。 - e2e.sh 新增 solutions_selftest(),并核对测试条数 == 答案文件数:测试发现 是按 tests/**/*.cpp 自动扫的,布局一改就可能一个都没扫到,而「0 个测试」 在 mcpp 眼里同样是 "test result ok" - CI 每档平台新增独立一段 `mcpp test -p solutions`,排在覆盖-还原之前, 失败定位最短 - e2e.sh / checker-e2e.sh / 文件名核对 job 的路径映射跟随改为 solutions/tests/ * docs: step 2 的环境验证改用 `mcpp test -p solutions` 上一版让 step 2 跑裸 `mcpp test`,然后解释「全红是对的」。这在逻辑上站不住: 工具链坏掉时也是全红,学习者看着同样的输出,分辨不出是自己还没做题还是环境 没装好——一个只会红的命令没法用来验证环境。 solutions/ 成为工程之后就有了确定的绿: mcpp test -p solutions # 验证环境: 52 份参考答案, 应当全绿 mcpp test # 你的进度表: 练习还没做, 此刻全红 两条命令各自含义明确:第一条绿 = 工具链没问题;第二条红 = 你的起点。 README 三语 + book 两语 + chapter_1 两语同步。chapter_1 里另外写清了答案与 练习靠 tests/ 相对路径配对,以及 `mcpp test -p solutions cpp11` 的筛选用法。 撰稿技能(.agents/skills/d2mcpp-authoring)的路径与「答案怎么验」也跟随更新: 新增答案后可以直接 `mcpp test -p solutions <slug>` 自查,不必再走覆盖流程。 * docs: step 2 只留环境验证,进度表挪到 step 3 的可选 note step 2 摆两条命令、再解释「第一条绿第二条红」,等于在验证环境这一步塞了 一个当下用不上的概念。step 2 现在只做一件事: mcpp test -p solutions # 验证环境: 52 份参考答案, 应当全绿 裸 `mcpp test`(你自己的进度表)本来就属于「不经过 d2x 怎么练」这一类, 归到 step 3 已有的那条可选 note 里,和 `mcpp test -p src/cpp11` 放一起: > 不想经过 d2x? 练习就是测试 —— `mcpp test` 打印你的完整进度表(动手前 > 全红), `mcpp test -p src/cpp11` 只跑某一章。 同步的地方: - README 三语 + book 两语:step 2 收敛为一条命令;<details> 里 clone 那条 路的环境验证也跟着改成 `mcpp test -p solutions`(原来还是裸 mcpp test) - chapter_1 两语:「验证环境」节同样只留参考答案那条;裸 `mcpp test` 落到 已有的「原生模式(可选)」节,作为该节三条命令里的第一条
1 parent 32a7a3e commit 6bcf5db

67 files changed

Lines changed: 559 additions & 56 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.agents/skills/d2mcpp-authoring/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ When adding a feature numbered `NN` with slug `topic` (e.g. `06-scoped-enums`):
7171
2. `book/en/src/<std>/NN-topic.md` — en chapter (translate prose, keep code identical)
7272
3. `src/<std>/tests/NN-topic/K.cpp` — one or more exercises (`K` = 0,1,2…), zh comments
7373
4. `src/en/<std>/tests/NN-topic/K.cpp` — en exercises (translate comments only)
74-
5. `solutions/<std>/NN-topic/K.cpp` — reference solution per exercise (zh/en 共用)
74+
5. `solutions/tests/<std>/NN-topic/K.cpp` — reference solution per exercise (zh/en 共用)
7575
6. (nothing to register — exercises are tests, discovered by directory convention)
7676
8. Add the chapter line to **both** `book/src/SUMMARY.md` and `book/en/src/SUMMARY.md`
7777
9. Add a changelog entry to **both** `book/src/changelog.md` and `book/en/src/changelog.md`

.agents/skills/d2mcpp-authoring/references/anatomy.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ book/en/src/changelog.md # en changelog (add entry)
1919
src/<std>/tests/NN-topic/K.cpp # zh exercise(s) — no registration needed
2020
src/en/<std>/tests/NN-topic/K.cpp # en exercise(s) — no registration needed
2121
22-
solutions/<std>/NN-topic/K.cpp # reference solution(s), zh/en 共用
22+
solutions/tests/<std>/NN-topic/K.cpp # reference solution(s), zh/en 共用
2323
```
2424

2525
Repo-level shared basis (NOT per-lesson, created once, never edited by hand):
@@ -37,7 +37,7 @@ snapshot via `msvc-stl/SOURCE.md` when needed.
3737

3838
A new `<std>` section that does not exist yet needs: a `src/<std>/mcpp.toml` (copy
3939
`src/cpp14/mcpp.toml`, change the name), `src/<std>/tests/` + `src/en/<std>/tests/` +
40-
`solutions/<std>/` directories, the member added to the root `mcpp.toml`
40+
`solutions/tests/<std>/` directories, the member added to the root `mcpp.toml`
4141
workspace list (both `src/<std>` and `src/en/<std>`), and the section heading in both
4242
`SUMMARY.md` files (e.g. `# C++14核心语言特性` / `# C++14 Core Language
4343
Features`).
@@ -79,9 +79,11 @@ change compile flags.
7979

8080
## Solution registration — there is none either
8181

82-
Drop the file at `solutions/<std>/NN-topic/K.cpp` (zh/en share one solution).
83-
CI swaps it over the exercise and asserts it passes; see
84-
`d2x/buildtools/tests/e2e.sh`.
82+
Drop the file at `solutions/tests/<std>/NN-topic/K.cpp` (zh/en share one
83+
solution). `solutions/` is itself an mcpp package, so the file becomes a test by
84+
directory convention — verify it with `mcpp test -p solutions <slug>`, no copying
85+
involved. CI additionally swaps it over the exercise and asserts it passes there
86+
too; see `d2x/buildtools/tests/e2e.sh`.
8587

8688
## SUMMARY registration
8789

.github/workflows/dslings-ref-ci.yml

Lines changed: 159 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,25 @@ name: Validate exercises and reference solutions
77
# 练习即测试:e2e 走 `mcpp test`,与 `d2x checker` 内部的 Provider 是同一条
88
# 链路,所以 CI 绿灯等价于学习者本地能跑通,而不是另一条平行的构建路径。
99
#
10+
# 两层都要验,因为它们的失效方式不同:
11+
# - `mcpp test` —— 编译/运行这一层(e2e.sh)
12+
# - `d2x checker` —— 在它之上还叠了 Provider 的 NDJSON 协议、进度持久化、
13+
# 文件监听三层(checker-e2e.sh)。这三层断掉时 mcpp test
14+
# 照样全绿,Windows 上就出过这样的静默回归(d2mcpp#87)。
15+
#
16+
# 平台矩阵拆成五档,因为它们各有各的踩法,合成一个 ubuntu job 等于没测:
17+
# linux / macos / windows-10 线 / windows-11 线 / windows 且无 MSVC STL
18+
# 最后一档见下方 mask_msvc 的注释。
19+
#
1020
# 依赖 mcpp >= 0.0.104(测试能力批次:逐测试隔离 / 过滤 / --list / --timeout /
1121
# --message-format json / tests 吃 [build].flags)。
1222
#
13-
# 但真正的下限已被上游抬高:mcpplibs 依赖索引现在要求 mcpp >= 0.0.109,更低的
14-
# 版本一律 E0006「index requires mcpp >= 0.0.109」而拒绝解析依赖 —— 原先钉的
15-
# 0.0.104 自此装不出来。pin 见 .xlings.json,当前为 2026.8.1.1。
23+
# 但真正的下限已被上游抬高两次:
24+
# - mcpplibs 依赖索引要求 mcpp >= 0.0.109,更低版本一律 E0006 拒绝解析依赖
25+
# - 「无 MSVC STL 的 Windows」这一档要求 mcpp >= 2026.8.2.1:自动回落到
26+
# winlibs MinGW(x86_64-windows-gnu)是那个版本才有的能力,再早的版本在
27+
# 裸 Windows 上直接硬失败
28+
# pin 见 .xlings.json,当前为 2026.8.2.1。
1629

1730
on:
1831
push:
@@ -23,6 +36,7 @@ on:
2336
- "d2x/**"
2437
- "mcpp.toml"
2538
- ".d2x.json"
39+
- ".xlings.json"
2640
- ".github/workflows/dslings-ref-ci.yml"
2741
pull_request:
2842
paths:
@@ -31,52 +45,180 @@ on:
3145
- "d2x/**"
3246
- "mcpp.toml"
3347
- ".d2x.json"
48+
- ".xlings.json"
3449
- ".github/workflows/dslings-ref-ci.yml"
3550
workflow_dispatch:
3651

52+
env:
53+
XLINGS_VERSION: "0.4.51"
54+
XLINGS_NON_INTERACTIVE: "1"
55+
3756
jobs:
3857
validate-exercises:
39-
runs-on: ubuntu-latest
58+
name: validate (${{ matrix.name }})
59+
runs-on: ${{ matrix.os }}
60+
timeout-minutes: 120
4061

41-
env:
42-
XLINGS_VERSION: "0.4.51"
43-
XLINGS_NON_INTERACTIVE: "1"
62+
# GitHub 不提供 Windows 客户端版的 x64 托管 runner,只有 Server 镜像;这里
63+
# 用与各自客户端版共享内核基线的 Server 镜像代表两条产品线:
64+
# windows-2022 = Server 2022,与 Windows 10 22H2 同基线(10.0.20348)
65+
# windows-2025 = Server 2025,与 Windows 11 24H2 同基线(10.0.26100)
66+
# 这是托管 runner 上能覆盖到的最接近真实 Win10/Win11 的组合。
67+
strategy:
68+
fail-fast: false
69+
matrix:
70+
include:
71+
- name: linux
72+
os: ubuntu-latest
73+
langs: all # zh + en 两套课程都验
74+
- name: macos
75+
os: macos-14
76+
langs: zh
77+
- name: windows-10 baseline
78+
os: windows-2022
79+
langs: zh
80+
- name: windows-11 baseline
81+
os: windows-2025
82+
langs: zh
83+
# 学习者的机器上装了 Visual Studio 才是少数情况。这一档把 VS 从
84+
# runner 上藏掉,验证「一台干净的 Windows」同样能跑完整门课 ——
85+
# mcpp 会自动回落到自带的 winlibs MinGW(x86_64-windows-gnu)。
86+
- name: windows-11, no MSVC STL
87+
os: windows-2025
88+
langs: zh
89+
mask_msvc: true
90+
91+
defaults:
92+
run:
93+
shell: bash
4494

4595
steps:
4696
- uses: actions/checkout@v4
4797

98+
# 必须排在装工具链之前:此后的任何一步都不该看见 Visual Studio。
99+
- name: Mask Visual Studio (simulate a bare Windows box)
100+
if: matrix.mask_msvc
101+
shell: pwsh
102+
run: |
103+
$ErrorActionPreference = 'Continue'
104+
105+
# mcpp 的三条 MSVC 发现路径(vswhere / 环境变量 / 已知路径扫描)最终
106+
# 都落到 <vsRoot>\VC\Tools\MSVC,所以藏的是 VC 目录而不是 VS 根目录:
107+
# 根目录在 runner 上被进程占着改不了名,低一层的 VC 可以。
108+
$vswhere = "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe"
109+
if (Test-Path $vswhere) { Rename-Item $vswhere "vswhere.exe.masked" }
110+
111+
Resolve-Path "C:\Program Files*\Microsoft Visual Studio\*\*\VC" `
112+
-ErrorAction SilentlyContinue | ForEach-Object {
113+
$p = $_.Path
114+
Write-Host "masking $p"
115+
try { Rename-Item -LiteralPath $p -NewName "VC.masked" -ErrorAction Stop }
116+
catch { Write-Host " rename failed: $($_.Exception.Message)" }
117+
}
118+
119+
foreach ($v in @('VSINSTALLDIR','VCINSTALLDIR','VCToolsInstallDir',
120+
'VS170COMNTOOLS','VS160COMNTOOLS','VS150COMNTOOLS')) {
121+
"$v=" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
122+
}
123+
124+
# 就地检查遮蔽的后置条件。漏遮的后果是这一档静悄悄变成第二个
125+
# windows-11 baseline —— 绿灯,但什么都没验到。
126+
$left = Get-ChildItem "C:\Program Files*\Microsoft Visual Studio\*\*\VC\Tools\MSVC" `
127+
-Directory -ErrorAction SilentlyContinue
128+
if ($left) {
129+
Write-Host "FAIL: VC tools still present after masking:"
130+
$left | ForEach-Object { Write-Host " $($_.FullName)" }
131+
exit 1
132+
}
133+
Write-Host "Visual Studio masked: no VC\Tools\MSVC remains."
134+
48135
# 官方一键安装脚本自带镜像回退。手动 curl GitHub release 包会被
49136
# release CDN 的间歇性 504 打断。
50-
- name: Install xlings ${{ env.XLINGS_VERSION }}
137+
- name: Install xlings ${{ env.XLINGS_VERSION }} (Linux/macOS)
138+
if: runner.os != 'Windows'
51139
run: |
52140
set -eu
53141
curl -fsSL https://raw.githubusercontent.com/openxlings/xlings/main/tools/other/quick_install.sh \
54142
| bash -s "v${XLINGS_VERSION}"
55143
echo "$HOME/.xlings/subos/current/bin" >> "$GITHUB_PATH"
56144
57-
# 按 .xlings.json 安装 mcpp。mcpp 自带工具链沙箱,无需另装 gcc。
58-
- name: Install mcpp
145+
- name: Install xlings (Windows)
146+
if: runner.os == 'Windows'
147+
shell: pwsh
148+
run: |
149+
irm https://raw.githubusercontent.com/openxlings/xlings/main/tools/other/quick_install.ps1 | iex
150+
"$env:USERPROFILE\.xlings\subos\current\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
151+
152+
# 按 .xlings.json 安装 mcpp + d2x。mcpp 自带工具链沙箱,无需另装 gcc。
153+
- name: Install pinned toolchain (.xlings.json)
59154
run: |
60155
set -eu
61156
xlings update
62157
xlings install -y
158+
mcpp --version
159+
d2x --version
160+
161+
- name: Report runner OS
162+
if: runner.os == 'Windows'
163+
shell: pwsh
164+
run: |
165+
$os = Get-CimInstance Win32_OperatingSystem
166+
Write-Host "runner=${{ matrix.os }} caption=$($os.Caption) build=$($os.Version)"
63167
64168
- name: Build d2x Provider
65169
run: mcpp build -p d2x/buildtools
66170

67-
- name: Validate exercises and solutions (zh + en)
68-
run: bash d2x/buildtools/tests/e2e.sh all
171+
# mcpp 把产物按 target triple 分目录,所以目录名就是「实际用了哪条
172+
# 工具链」最直接的证据。遮蔽生效时它必须是 gnu 而不是 msvc。
173+
- name: Assert MinGW fallback took effect (no MSVC STL)
174+
if: matrix.mask_msvc
175+
run: |
176+
set -eu
177+
ls d2x/buildtools/target/
178+
if [ ! -d d2x/buildtools/target/x86_64-windows-gnu ]; then
179+
echo "FAIL: 期望回落到 x86_64-windows-gnu,实际产物 target 目录如上"
180+
exit 1
181+
fi
182+
echo "OK: 无 MSVC STL 时回落到 winlibs MinGW (x86_64-windows-gnu)"
183+
184+
# 参考答案自检 —— 单独一段,因为它是最便宜也最直白的一条:solutions/ 自己
185+
# 就是一个 mcpp 工程,一条命令、零副作用,红了就说明答案本身编不过或跑不过,
186+
# 跟练习目录、跟 d2x 都没关系。放在覆盖-还原那套之前,失败定位最短。
187+
- name: mcpp test -p solutions (reference answers must be all green)
188+
run: mcpp test -p solutions
189+
190+
# 第一层:`mcpp test` —— pristine 全部不通过 + 覆盖答案后全部通过
191+
# (e2e.sh 内部还会再跑一遍上面那条自检并核对测试条数,防止布局改动后
192+
# tests/**/*.cpp 一个都没扫到却依然 "test result ok")
193+
- name: mcpp test (pristine fails, solutions all pass)
194+
run: bash d2x/buildtools/tests/e2e.sh ${{ matrix.langs }}
195+
196+
# 第二层:`d2x checker` —— 答案就位后 checker 必须自己走完全程并退 0
197+
- name: d2x checker (solutions drive it to completion)
198+
run: bash d2x/buildtools/tests/checker-e2e.sh zh
199+
200+
- name: d2x checker — en course
201+
if: matrix.langs == 'all'
202+
run: bash d2x/buildtools/tests/checker-e2e.sh en
203+
204+
# 纯文件名核对,与工具链无关,跑一个平台就够。
205+
solutions-parity:
206+
name: exercises ↔ solutions filename parity
207+
runs-on: ubuntu-latest
208+
steps:
209+
- uses: actions/checkout@v4
69210

70211
- name: Verify exercises ↔ solutions filename parity
71212
run: |
72213
set -eu
73214
# en/ 镜像跳过 —— 参考答案与语言无关,两边共用同一份
74215
missing=0
75-
for f in $(find intro/tests cpp*/tests -name '*.cpp'); do
76-
std="${f%%/*}"
77-
rel="${f#*/tests/}"
78-
if [ ! -f "solutions/$std/$rel" ]; then
79-
echo "::warning::missing solutions/$std/$rel (paired with $f)"
216+
for f in $(find src/intro/tests src/cpp*/tests -name '*.cpp'); do
217+
rel="${f#src/}"
218+
std="${rel%%/*}"
219+
rest="${rel#*/tests/}"
220+
if [ ! -f "solutions/tests/$std/$rest" ]; then
221+
echo "::warning::missing solutions/tests/$std/$rest (paired with $f)"
80222
missing=$((missing+1))
81223
fi
82224
done

.xlings.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"workspace": {
3-
"d2x": "2026.08.02.1",
3+
"d2x": "2026.08.02.2",
44
"mdbook": "0.4.43",
55
"code": "",
66
"mcpp": {
7-
"linux": "2026.8.1.1",
8-
"macosx": "2026.8.1.1",
9-
"windows": "2026.8.1.1"
7+
"linux": "2026.8.2.1",
8+
"macosx": "2026.8.2.1",
9+
"windows": "2026.8.2.1"
1010
}
1111
}
1212
}

README.md

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343

4444
### Interactive Code Practice (Local)
4545

46-
**Step 1 - Install the d2x tool**
46+
**Step 1 - Install the [d2x](https://github.com/d2learn/d2x) and [mcpp](https://github.com/mcpp-community/mcpp) tools**
4747

4848
<details>
4949
<summary>click to view xlings installation command</summary>
@@ -69,34 +69,48 @@ irm https://raw.githubusercontent.com/openxlings/xlings/main/tools/other/quick_i
6969
</details>
7070

7171
```bash
72-
xlings install d2x -y # exercise framework CLI
72+
xlings install d2x mcpp -y # d2x: exercise framework CLI | mcpp: C++ build & test tool
7373
```
7474

75-
**Step 2 - Get the course (choose one)**
75+
**Step 2 - Get the course, then configure and verify the environment**
7676

7777
```bash
78-
# Option A - one command: download the course, toolchain auto-configured
79-
d2x install d2mcpp
78+
d2x install d2mcpp # download the course, toolchain auto-configured
8079
cd d2mcpp
80+
mcpp test -p solutions # verify the environment: 52 reference answers, all green
8181
```
8282

83+
> `solutions/` is a real mcpp package, so this compiles and runs all 52 reference
84+
> answers — an unambiguous green tick that your toolchain is ready.
85+
86+
<details>
87+
<summary>optional - start from the git source instead</summary>
88+
89+
---
90+
8391
```bash
84-
# Option B - git clone the source
8592
git clone https://github.com/mcpp-community/d2mcpp.git # or your fork
8693
cd d2mcpp
8794
xlings install -y # toolchain pinned by .xlings.json
95+
mcpp test -p solutions # same environment check
8896
```
8997

9098
> Tip: fork this repo and clone your fork — `git commit / push` keeps your practice progress in your own repository.
9199
100+
---
101+
102+
</details>
103+
92104
**Step 3 - Start practicing**
93105

94106
```bash
95107
d2x checker # practice loop: edit -> save -> auto-check -> advance
96108
d2x status # progress overview
97109
```
98110

99-
> Exercises are real mcpp tests — `mcpp test -p src/cpp11` works too (no d2x involved).
111+
> Prefer plain mcpp? The exercises **are** the tests — `mcpp test` prints your whole
112+
> progress table (all red until you start), and `mcpp test -p src/cpp11` runs a single
113+
> chapter.
100114
101115
**👉 [more details...](https://mcpp-community.github.io/d2mcpp/base/chapter_1.html)**
102116

0 commit comments

Comments
 (0)