Skip to content

Commit 5aa32f8

Browse files
committed
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`,并说明「刚拿到课程 时全部未通过」既是起点也是工具链已通的证据
1 parent 96c3617 commit 5aa32f8

2 files changed

Lines changed: 38 additions & 0 deletions

File tree

book/en/src/base/chapter_1.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ wget https://raw.githubusercontent.com/openxlings/xlings/main/tools/other/quick_
3232
Invoke-Expression (Invoke-Webrequest 'https://raw.githubusercontent.com/openxlings/xlings/main/tools/other/quick_install.ps1' -UseBasicParsing).Content
3333
```
3434

35+
**With xlings in place, install the two tools this course needs**
36+
37+
```bash
38+
xlings install d2x mcpp -y # d2x: exercise framework CLI | mcpp: C++ build & test tool
39+
```
40+
41+
> [d2x](https://github.com/d2learn/d2x) drives exercise checking and progression, [mcpp](https://github.com/mcpp-community/mcpp) builds and runs them — the exercises *are* mcpp tests
42+
3543
## 1. Get Project and Auto-configure Environment
3644

3745
> Download the project to current directory and automatically configure local environment
@@ -40,6 +48,17 @@ Invoke-Expression (Invoke-Webrequest 'https://raw.githubusercontent.com/openxlin
4048
d2x install d2mcpp
4149
```
4250

51+
### Verify the environment
52+
53+
> Run the full test suite once inside the project to confirm the toolchain works
54+
55+
```bash
56+
cd d2mcpp
57+
mcpp test
58+
```
59+
60+
> The exercises **are** the tests. On a fresh checkout this reports them all as failing — that is the expected starting point, and it already proves the compile-and-run path works. Drop the reference answers from `solutions/` in and the very same command goes all green.
61+
4362
### Local E-book
4463

4564
> Execute `d2x book` command in the project directory to open local documentation (includes usage guide and e-book)

book/src/base/chapter_1.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ wget https://raw.githubusercontent.com/openxlings/xlings/main/tools/other/quick_
3232
Invoke-Expression (Invoke-Webrequest 'https://raw.githubusercontent.com/openxlings/xlings/main/tools/other/quick_install.ps1' -UseBasicParsing).Content
3333
```
3434

35+
**装好 xlings 后, 用它装本教程需要的两个工具**
36+
37+
```bash
38+
xlings install d2x mcpp -y # d2x: 练习框架 CLI | mcpp: C++ 构建与测试工具
39+
```
40+
41+
> [d2x](https://github.com/d2learn/d2x) 负责练习的检测与推进, [mcpp](https://github.com/mcpp-community/mcpp) 负责构建与运行 —— 练习本身就是 mcpp 的测试
42+
3543
## 1.获取项目及自动配置环境
3644

3745
> 下载项目到当前目录并自动配置本地环境
@@ -40,6 +48,17 @@ Invoke-Expression (Invoke-Webrequest 'https://raw.githubusercontent.com/openxlin
4048
d2x install d2mcpp
4149
```
4250

51+
### 验证环境
52+
53+
> 进入项目目录后跑一遍全量测试, 确认工具链是通的
54+
55+
```bash
56+
cd d2mcpp
57+
mcpp test
58+
```
59+
60+
> 练习**就是**测试。刚拿到课程时这里会报告全部未通过 —— 这正是练习的起点, 同时也说明编译运行这条链路已经跑通了。把 `solutions/` 里的参考答案覆盖进去, 同一条命令就会全绿。
61+
4362
### 本地电子书
4463

4564
> 可以在项目目录执行`d2x book`命令, 打开本地文档(包含使用说明和电子书)

0 commit comments

Comments
 (0)