diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index ec8c98e6..9d2cdf42 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -1,300 +1,358 @@ -import { link } from 'fs'; -import { defineConfig } from 'vitepress' -import markdownItContainer from 'markdown-it-container'; -import containerMdExtend from './detail-plugin.js'; -import markdowinItCharts from 'markdown-it-charts'; -import mathjax3 from 'markdown-it-mathjax3'; +import { link } from "fs"; +import { defineConfig } from "vitepress"; +import markdownItContainer from "markdown-it-container"; +import containerMdExtend from "./detail-plugin.js"; +import markdowinItCharts from "markdown-it-charts"; +import mathjax3 from "markdown-it-mathjax3"; import { withMermaid } from "vitepress-plugin-mermaid"; -import { head } from './ga-plugin'; - +import { head } from "./ga-plugin"; // https://vitepress.dev/reference/site-config export default withMermaid({ - title: "プログラミング基礎講習会", - description: "プログラミング基礎講習会テキスト", - cleanUrls: true, - markdown: { - - // lineNumbers: true, - config: (md) => { - md.use( - markdownItContainer, - 'spoiler', - containerMdExtend(md), - ); - md.use(markdowinItCharts); - md.use(mathjax3); - } + title: "プログラミング基礎講習会", + description: "プログラミング基礎講習会テキスト", + cleanUrls: true, + markdown: { + // lineNumbers: true, + config: (md) => { + md.use(markdownItContainer, "spoiler", containerMdExtend(md)); + md.use(markdowinItCharts); + md.use(mathjax3); }, - themeConfig: { - // https://vitepress.dev/reference/default-theme-config - search: { - provider: 'local' - }, - nav: [ - { text: 'ホーム', link: '/' }, - ], + }, + lastUpdated: true, + themeConfig: { + // https://vitepress.dev/reference/default-theme-config + search: { + provider: "local", + }, + nav: [{ text: "ホーム", link: "/" }], - sidebar: { - '/cpp/': [ - { - text: '2025年度版テキスト', - link: '/text/chapter-0/', - }, - { - text: 'はじめに', - link: '/cpp/preface/', - items: [ - { text: 'この講習会について', link: '/cpp/preface/1' }, - { text: 'このテキストについて', link: '/cpp/preface/2' }, - ] - }, - { - text: '1. 環境構築', - link: '/cpp/chapter-1/', - items: [ - { text: '1-A. Macの環境構築', link: '/cpp/chapter-1/1-A' }, - { text: '1-B. Windowsの環境構築', link: '/cpp/chapter-1/1-B' }, - ] - }, - { - text: '2. はじめてのプログラミング', - link: '/cpp/chapter-2/', - items: [ - { text: '2.1 プログラミングの基礎知識', link: '/cpp/chapter-2/1' }, - { text: '2.2 作業環境の構築', link: '/cpp/chapter-2/2' }, - { text: '2.3 はじめてのプログラミング', link: '/cpp/chapter-2/3' }, - { - text: '練習問題', - link: '/cpp/chapter-2/problems/', - collapsed: true, - items: [ - { text: '2-Q1. Hello, Shell!', link: '/cpp/chapter-2/problems/hello-shell' }, - ], - }, - ] - }, + sidebar: { + "/cpp/": [ + { + text: "2025年度版テキスト", + link: "/text/chapter-0/", + }, + { + text: "はじめに", + link: "/cpp/preface/", + items: [ + { text: "この講習会について", link: "/cpp/preface/1" }, + { text: "このテキストについて", link: "/cpp/preface/2" }, + ], + }, + { + text: "1. 環境構築", + link: "/cpp/chapter-1/", + items: [ + { text: "1-A. Macの環境構築", link: "/cpp/chapter-1/1-A" }, + { text: "1-B. Windowsの環境構築", link: "/cpp/chapter-1/1-B" }, + ], + }, + { + text: "2. はじめてのプログラミング", + link: "/cpp/chapter-2/", + items: [ + { text: "2.1 プログラミングの基礎知識", link: "/cpp/chapter-2/1" }, + { text: "2.2 作業環境の構築", link: "/cpp/chapter-2/2" }, + { text: "2.3 はじめてのプログラミング", link: "/cpp/chapter-2/3" }, + { + text: "練習問題", + link: "/cpp/chapter-2/problems/", + collapsed: true, + items: [ { - text: '3. 変数と入出力', - link: '/cpp/chapter-3/', - items: [ - { text: '3.1 Hello, traP! の解説', link: '/cpp/chapter-3/1' }, - { text: '3.2 int型変数', link: '/cpp/chapter-3/2' }, - { text: '3.3 標準入出力', link: '/cpp/chapter-3/3' }, - { - text: '練習問題', - link: '/cpp/chapter-3/problems/', - collapsed: true, - items: [ - { text: '3-A1. Multiplication', link: '/cpp/chapter-3/problems/multiplication' }, - { text: '3-B1. 4bit', link: '/cpp/chapter-3/problems/4bit' }, - { text: '3-B2. Sum', link: '/cpp/chapter-3/problems/sum' }, - ], - }, - ] + text: "2-Q1. Hello, Shell!", + link: "/cpp/chapter-2/problems/hello-shell", }, - ], - '/text/': [ - { - text: '2026年度版テキスト [WIP]', - link: '/cpp/preface/', + ], }, + ], + }, + { + text: "3. 変数と入出力", + link: "/cpp/chapter-3/", + items: [ + { text: "3.1 Hello, traP! の解説", link: "/cpp/chapter-3/1" }, + { text: "3.2 int型変数", link: "/cpp/chapter-3/2" }, + { text: "3.3 標準入出力", link: "/cpp/chapter-3/3" }, { - text: 'About', - items: [ - { text: 'このテキストについて', link: '/about' } - ] + text: "練習問題", + link: "/cpp/chapter-3/problems/", + collapsed: true, + items: [ + { + text: "3-A1. Multiplication", + link: "/cpp/chapter-3/problems/multiplication", + }, + { text: "3-B1. 4bit", link: "/cpp/chapter-3/problems/4bit" }, + { text: "3-B2. Sum", link: "/cpp/chapter-3/problems/sum" }, + ], }, + ], + }, + ], + "/text/": [ + { + text: "2026年度版テキスト [WIP]", + link: "/cpp/preface/", + }, + { + text: "About", + items: [{ text: "このテキストについて", link: "/about" }], + }, + { + text: "0. はじめに", + link: "/text/chapter-0/", + items: [ + { text: "環境構築 - Mac", link: "/text/chapter-0/enviroment/mac" }, { - text: '0. はじめに', - link: '/text/chapter-0/', - items: [ - { text: '環境構築 - Mac', link: '/text/chapter-0/enviroment/mac' }, - { text: '環境構築 - Windows', link: '/text/chapter-0/enviroment/windows' }, - { text: '講習会ガイダンス', link: '/text/chapter-0/guidance' } - ] + text: "環境構築 - Windows", + link: "/text/chapter-0/enviroment/windows", }, + { text: "講習会ガイダンス", link: "/text/chapter-0/guidance" }, + ], + }, + { + text: "I. はじめてのプログラミング", + link: "/text/chapter-1/", + items: [ + { text: "コンパイルとOS", link: "/text/chapter-1/compile-os" }, + { text: "ターミナルの扱い", link: "/text/chapter-1/terminal" }, { - text: 'I. はじめてのプログラミング', - link: '/text/chapter-1/', - items: [ - { text: 'コンパイルとOS', link: '/text/chapter-1/compile-os' }, - { text: 'ターミナルの扱い', link: '/text/chapter-1/terminal' }, - { - text: '練習問題', - link: '/text/chapter-1/practice/', - collapsed: true, - items: [ - { text: '1-B1. はじめてのプログラミング nano 編', link: '/text/chapter-1/practice/nano-test' }, - { text: '1-C1. Hello shell', link: '/text/chapter-1/practice/hello-shell' }, - ], - }, - ], + text: "練習問題", + link: "/text/chapter-1/practice/", + collapsed: true, + items: [ + { + text: "1-B1. はじめてのプログラミング nano 編", + link: "/text/chapter-1/practice/nano-test", + }, + { + text: "1-C1. Hello shell", + link: "/text/chapter-1/practice/hello-shell", + }, + ], }, + ], + }, + { + text: "II. 変数と入出力", + link: "/text/chapter-2/", + items: [ { - text: 'II. 変数と入出力', - link: '/text/chapter-2/', - items: [ - { text: 'はじめてのプログラミング解説', link: '/text/chapter-2/hello-world' }, - { text: 'int 変数', link: '/text/chapter-2/variables' }, - { text: '変数の入力', link: '/text/chapter-2/input' }, - { - text: '練習問題', - link: '/text/chapter-2/practice/', - collapsed: true, - items: [ - { text: '2-A1. Multiplication', link: '/text/chapter-2/practice/multiplication' }, - { text: '2-B1. 4bit', link: '/text/chapter-2/practice/4bit' }, - { text: '2-B2. Sum', link: '/text/chapter-2/practice/sum' }, - ], - }, - ] + text: "はじめてのプログラミング解説", + link: "/text/chapter-2/hello-world", }, + { text: "int 変数", link: "/text/chapter-2/variables" }, + { text: "変数の入力", link: "/text/chapter-2/input" }, { - text: 'III. 演算・計算', - link: '/text/chapter-3/', - items: [ - { text: '条件分岐', link: '/text/chapter-3/if-else' }, - { text: '型', link: '/text/chapter-3/type' }, - { - text: '練習問題', - link: '/text/chapter-3/practice/', - collapsed: true, - items: [ - { text: '3-A1. Echo', link: '/text/chapter-3/practice/echo' }, - { text: '3-A2. Fraction', link: '/text/chapter-3/practice/fraction' }, - { text: '3-B1. int128', link: '/text/chapter-3/practice/int128' }, - { text: '3-B2. De Morgan\'s laws', link: '/text/chapter-3/practice/de-morgans-laws' }, - ] - }, - ] + text: "練習問題", + link: "/text/chapter-2/practice/", + collapsed: true, + items: [ + { + text: "2-A1. Multiplication", + link: "/text/chapter-2/practice/multiplication", + }, + { text: "2-B1. 4bit", link: "/text/chapter-2/practice/4bit" }, + { text: "2-B2. Sum", link: "/text/chapter-2/practice/sum" }, + ], }, + ], + }, + { + text: "III. 演算・計算", + link: "/text/chapter-3/", + items: [ + { text: "条件分岐", link: "/text/chapter-3/if-else" }, + { text: "型", link: "/text/chapter-3/type" }, { - text: 'IV. 繰り返し処理', - link: '/text/chapter-4/', - items: [ - { text: 'for ①', link: '/text/chapter-4/for-basic' }, - { text: 'while', link: '/text/chapter-4/while' }, - { text: '配列', link: '/text/chapter-4/array' }, - { text: '文字列 ②', link: '/text/chapter-4/string' }, - { text: 'for ②', link: '/text/chapter-4/for-advanced' }, - { - text: '練習問題', - link: '/text/chapter-4/practice/' , - collapsed: true, - items: [ - { text: '4-A1. Fibonatti', link: '/text/chapter-4/practice/fibonatti' }, - { text: '4-A2. DO NOT FAIL', link: '/text/chapter-4/practice/do-not-fail' }, - { text: '4-A3. lower or UPPER', link: '/text/chapter-4/practice/lower-or-upper' }, - { text: '4-B1. Fizz-Buzz 2D', link: '/text/chapter-4/practice/fizz-buzz-2d' }, - ] - }, - ] + text: "練習問題", + link: "/text/chapter-3/practice/", + collapsed: true, + items: [ + { text: "3-A1. Echo", link: "/text/chapter-3/practice/echo" }, + { + text: "3-A2. Fraction", + link: "/text/chapter-3/practice/fraction", + }, + { + text: "3-B1. int128", + link: "/text/chapter-3/practice/int128", + }, + { + text: "3-B2. De Morgan's laws", + link: "/text/chapter-3/practice/de-morgans-laws", + }, + ], }, + ], + }, + { + text: "IV. 繰り返し処理", + link: "/text/chapter-4/", + items: [ + { text: "for ①", link: "/text/chapter-4/for-basic" }, + { text: "while", link: "/text/chapter-4/while" }, + { text: "配列", link: "/text/chapter-4/array" }, + { text: "文字列 ②", link: "/text/chapter-4/string" }, + { text: "for ②", link: "/text/chapter-4/for-advanced" }, { - text: 'V. コードの簡易化① - Function', - link: '/text/chapter-5/', - items: [ - { text: '関数とは', link: '/text/chapter-5/about-function' }, - { text: '引数', link: '/text/chapter-5/argument' }, - { text: '返り値', link: '/text/chapter-5/return-value' }, - { text: '参照渡し', link: '/text/chapter-5/call-by-ref' }, - { - text: '練習問題', - link: '/text/chapter-5/practice/', - collapsed: true, - items: [ - { text: '5-A1. Divide each difficulty', link: '/text/chapter-5/practice/divide-each-difficulty' }, - { text: '5-A2. Operator+=', link: '/text/chapter-5/practice/plus-equal' }, - ] - } - ] + text: "練習問題", + link: "/text/chapter-4/practice/", + collapsed: true, + items: [ + { + text: "4-A1. Fibonatti", + link: "/text/chapter-4/practice/fibonatti", + }, + { + text: "4-A2. DO NOT FAIL", + link: "/text/chapter-4/practice/do-not-fail", + }, + { + text: "4-A3. lower or UPPER", + link: "/text/chapter-4/practice/lower-or-upper", + }, + { + text: "4-B1. Fizz-Buzz 2D", + link: "/text/chapter-4/practice/fizz-buzz-2d", + }, + ], }, + ], + }, + { + text: "V. コードの簡易化① - Function", + link: "/text/chapter-5/", + items: [ + { text: "関数とは", link: "/text/chapter-5/about-function" }, + { text: "引数", link: "/text/chapter-5/argument" }, + { text: "返り値", link: "/text/chapter-5/return-value" }, + { text: "参照渡し", link: "/text/chapter-5/call-by-ref" }, { - text: 'VI. コードの簡易化② - Struct', - link: '/text/chapter-6/', - items: [ - { text: '構造体', link: '/text/chapter-6/struct' }, - { text: 'メソッド', link: '/text/chapter-6/method' }, - { - text: '練習問題', - link: '/text/chapter-6/practice/', - collapsed: true, - items: [ - { text: '6-A1. Order', link: '/text/chapter-6/practice/order' }, - ] - }, - ] + text: "練習問題", + link: "/text/chapter-5/practice/", + collapsed: true, + items: [ + { + text: "5-A1. Divide each difficulty", + link: "/text/chapter-5/practice/divide-each-difficulty", + }, + { + text: "5-A2. Operator+=", + link: "/text/chapter-5/practice/plus-equal", + }, + ], }, - { text: 'VII. おわりに・おまけ', link: '/text/chapter-7/' }, + ], + }, + { + text: "VI. コードの簡易化② - Struct", + link: "/text/chapter-6/", + items: [ + { text: "構造体", link: "/text/chapter-6/struct" }, + { text: "メソッド", link: "/text/chapter-6/method" }, { - text: 'VIII. 発展事項 (WIP)', - link: '/text/chapter-8/', - items: [ - { text: '計算量とオーダー', link: '/text/chapter-8/complexity' }, - { text: '再帰関数', link: '/text/chapter-8/recursive-function' }, - { text: '実行時間', link: '/text/chapter-8/exec-time' }, - { text: 'カプセル化', link: '/text/chapter-8/capsule' }, - { - text: '練習問題', - link: '/text/chapter-8/practice/', - collapsed: true, - items: [ - { text: 'Capsulated Zer0-Star', link: '/text/chapter-8/practice/capsulate-user' }, - { text: 'Exponentation', link: '/text/chapter-8/practice/exponentation' }, - ], - }, - ], + text: "練習問題", + link: "/text/chapter-6/practice/", + collapsed: true, + items: [ + { text: "6-A1. Order", link: "/text/chapter-6/practice/order" }, + ], }, + ], + }, + { text: "VII. おわりに・おまけ", link: "/text/chapter-7/" }, + { + text: "VIII. 発展事項 (WIP)", + link: "/text/chapter-8/", + items: [ + { text: "計算量とオーダー", link: "/text/chapter-8/complexity" }, + { text: "再帰関数", link: "/text/chapter-8/recursive-function" }, + { text: "実行時間", link: "/text/chapter-8/exec-time" }, + { text: "カプセル化", link: "/text/chapter-8/capsule" }, { - text: 'for traP Member Only', - items: [ - { text: '講習会 Wiki ページ', link: 'https://wiki.trap.jp/Event/welcome/25/lecture/pg-basic' }, - // { text: '練習問題', link: 'https://md.trap.jp/IE4NUAc_RR-USMIXlevsgA' }, - ] + text: "練習問題", + link: "/text/chapter-8/practice/", + collapsed: true, + items: [ + { + text: "Capsulated Zer0-Star", + link: "/text/chapter-8/practice/capsulate-user", + }, + { + text: "Exponentation", + link: "/text/chapter-8/practice/exponentation", + }, + ], }, + ], + }, + { + text: "for traP Member Only", + items: [ { - text: 'TA 向けテキストガイド', - items: [ - { text: 'Chapter 0', link: '/guide/chapter-0' }, - { text: 'Chapter 1', link: '/guide/chapter-1' }, - { text: 'Chapter 2-3', link: '/guide/chapter-2-3' }, - // { text: 'Chapter 4', link: '/guide/chapter-4' }, - // { text: 'Chapter 5', link: '/guide/chapter-5' }, - // { text: 'Chapter 6', link: '/guide/chapter-6' }, - ] + text: "講習会 Wiki ページ", + link: "https://wiki.trap.jp/Event/welcome/25/lecture/pg-basic", }, - { - text: 'プライバシーポリシー', link: '/privacy-policy' - } - ], + // { text: '練習問題', link: 'https://md.trap.jp/IE4NUAc_RR-USMIXlevsgA' }, + ], }, - - socialLinks: [ - { - icon: { - svg: 'traP_logo_icon' - }, - link: 'https://trap.jp' - } - ] + { + text: "TA 向けテキストガイド", + items: [ + { text: "Chapter 0", link: "/guide/chapter-0" }, + { text: "Chapter 1", link: "/guide/chapter-1" }, + { text: "Chapter 2-3", link: "/guide/chapter-2-3" }, + // { text: 'Chapter 4', link: '/guide/chapter-4' }, + // { text: 'Chapter 5', link: '/guide/chapter-5' }, + // { text: 'Chapter 6', link: '/guide/chapter-6' }, + ], + }, + { + text: "プライバシーポリシー", + link: "/privacy-policy", + }, + ], }, - head: [ - ['link', { rel: 'preconnect', href: 'https://fonts.googleapis.com' }], - ['link', { rel: 'preconnect', href: 'https://fonts.gstatic.com', crossorigin: '' }], - ['link', { rel: 'stylesheet', href: 'https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700&display=swap' }], - [ - 'script', - { - async: "true", - src: 'https://www.googletagmanager.com/gtag/js?id=G-977V87X2CQ', - }, - ], - [ - 'script', - {}, - "window.dataLayer = window.dataLayer || [];\nfunction gtag(){dataLayer.push(arguments);}\ngtag('js', new Date());\ngtag('config', 'G-977V87X2CQ');", - ], + + socialLinks: [ + { + icon: { + svg: 'traP_logo_icon', + }, + link: "https://trap.jp", + }, + ], + }, + head: [ + ["link", { rel: "preconnect", href: "https://fonts.googleapis.com" }], + [ + "link", + { rel: "preconnect", href: "https://fonts.gstatic.com", crossorigin: "" }, + ], + [ + "link", + { + rel: "stylesheet", + href: "https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700&display=swap", + }, + ], + [ + "script", + { + async: "true", + src: "https://www.googletagmanager.com/gtag/js?id=G-977V87X2CQ", + }, + ], + [ + "script", + {}, + "window.dataLayer = window.dataLayer || [];\nfunction gtag(){dataLayer.push(arguments);}\ngtag('js', new Date());\ngtag('config', 'G-977V87X2CQ');", ], -}) + ], +}); diff --git a/docs/cpp/chapter-1/1-B.md b/docs/cpp/chapter-1/1-B.md index 60bc68fa..0fb6723b 100644 --- a/docs/cpp/chapter-1/1-B.md +++ b/docs/cpp/chapter-1/1-B.md @@ -12,30 +12,53 @@ next: ## Step 1: WSLのインストール 1. でWindows Terminalをインストールする。(既にインストールされていれば飛ばしてOK) -2. アプリ検索の画面で、`Terminal`と入力し **「管理者として実行」** を押す。 +2. アプリ検索の画面で、`Windows Terminal`と入力し **「管理者として実行」** を押す。 ![](https://md.trap.jp/uploads/upload_367dc95b2cd3e74c808320a907977237.png) -3. `wsl --install -d Ubuntu` と入力して、エンターキーを押す。 + +:::tip +「管理者として実行」ボタンは、右下にある `∨` ボタンを押さないと表示されない場合があります。 + +![](./windows_terminal_01.png) + +![](./windows_terminal_02.png) + +::: +3. `wsl --install -d Ubuntu`と入力して、エンターキーを押す。 ![](https://md.trap.jp/uploads/upload_7266a7465d2df1dbc341237b2e4983b3.png) +:::tip +インストール中に「この操作を完了するために、システムを再起動する必要があります」などと表示されることがあります。その際はWindowsを再起動してください。再起動後、Windows Terminalを開いて`wsl -d Ubuntu`と入力すればUbuntuのセットアップが続けられます。 +::: + :::warning TA向け WSLインストールトラブルシューティング -`wsl --install` に失敗した際の手動インストールマニュアル +`wsl --install`に失敗した際の手動インストールマニュアル (Windowsバージョンの要件なども書いてあります) ::: :::warning TA向け -極稀に、BIOSでvirtualization設定が切られている為にWSLがインストールできない事があります。(`Please enable the Virtual Machine Platform Windows feature and ensure virtualization is enabled in the BIOS.` と表示されます。) -この場合はBIOSに入って、 Advanced -> Virtualizationの順で有効化してください。 +- 繰り返し再起動してもWSLノインストールができない場合、Windowsのアップデートを試してください。 +- 極稀に、BIOSでvirtualization設定が切られている為にWSLがインストールできない事があります。(`Please enable the Virtual Machine Platform Windows feature and ensure virtualization is enabled in the BIOS.`と表示されます。) + この場合はBIOSに入って、 Advanced -> Virtualizationの順で有効化してください。 +- `wsl --install`実行中にプログレスバーが止まって見えるとき、Spaceキーを押すと画面が更新されて進行が確認できる場合があります。 ::: -4. Ubuntuのアカウント設定をする。 +:::warning TA向け +::: + +1. Ubuntuのアカウント設定をする。 1. ターミナルの下部に`Enter new UNIX username:`と表示されていなければ`wsl -d Ubuntu`と入力してエンターキーを押す。 - それでも`Enter new UNIX username:`が表示されない場合(例えば「ディストリビューションが見つからない」という内容のエラーが表示される場合)は、インストールが失敗している可能性があるのでStep 1の1. からやり直してみる。(これでも上手くいかない場合はTAを呼んでください。) - 2. `Enter new UNIX username:`と表示されるので、**半角英数小文字**で好きなユーザーネームを設定する。(`take` とか `takemura` とか`ryugo`とか短い方が良い。フォルダの名前になります。) - 3. `New Password:`と表示されるので、WSL内で使いたいパスワードを入力。何も表示されませんが入力されています。入力できたら エンターキーを押す。 + + ::: tip + 環境によっては、`Enter new UNIX username:`ではなく、`Create new UNIX User`と表示されることがあるようです。この場合でも、そのまま進めてもらって構いません。 + ::: + + 2. `Enter new UNIX username:`と表示されるので、**半角英数小文字**で好きなユーザーネームを設定する。(`take`とか`takemura`とか`ryugo`とか短い方が良い。フォルダの名前になります。) + 3. `New Password:`と表示されるので、WSL内で使いたいパスワードを入力。**何も表示されませんが入力されています。**入力できたら エンターキーを押す。 4. `Retype New password:`と表示されるので、もう一度パスワードを入力する。 ![](https://md.trap.jp/uploads/upload_0fb105e906b7670d57ba0d0810418a95.png) @@ -44,15 +67,31 @@ WSLインストールトラブルシューティング パスワードは忘れないよう、どこかに記録しておきましょう。 ::: -5. ターミナルのウィンドウを閉じる。 -6. スタートからWindows Terminalを起動。 -7. `Ctrl`+`,`で設定画面を開く。 +::: info +「Linux用Windowsサブシステムにようこそ」という画面が出た場合、無視して閉じて構いません。 +::: + +:::warning TA向け +パスワードを打ち間違えて`[y/N]`と表示された場合、`y`を入力すれば再入力できます。タブを閉じてしまいパスワードを設定できなかった際は、`wsl --unregister Ubuntu`を実行してStep1の1.からやり直してください。 +::: + +1. ターミナルのウィンドウを閉じる。 +2. スタートからWindows Terminalを起動。 +3. `Ctrl`+`,`で設定画面を開く。 + +::: tip +`Ctrl`+`,`で設定が開かない場合は、画面上部にあるタブバーの`∨`ボタンをクリックして「設定」を選んでください。 +::: 8. 「既定のプロファイル」を「Ubuntu」に変更する。(複数あるならどれでも良い) ![](https://md.trap.jp/uploads/upload_0ce2e7b6aa4468178d034ffc65934316.png) - 9. 「保存」ボタンを押す。 10. Windows Terminalを閉じて、もう一度開く。 + +:::warning TA向け +再起動後もUbuntuがデフォルトのプロファイルとして起動しない場合は、もう一度Windows Terminalを閉じて開き直してください。それでも解決しない場合はWindows自体の再起動を試してください。 +::: + 11. [traQのtasksチャンネル](https://q.trap.jp/channels/event/workshop/pg-basic/tasks)でスタンプをつける。 ## Step 2: Clangのインストール @@ -68,12 +107,31 @@ WSLインストールトラブルシューティング 1. から自分のOS用のインストーラをダウンロードする。 2. ダウンロードされたインストーラを開き、画面の案内に従って、VSCodeをインストールする。 3. 起動後、`Ctrl`+`Shift`+`X`を押す。 -4. `Ctrl`+`,`を押して、出てきた画面に「Auto Save」と入力する。 -5. 「Files: Auto Save」の項目を探して、「afterDelay」に変更する。 + +::: info +初回起動時にログイン画面が出る場合があります。GitHubアカウントなどでログインをしても、右上の×ボタンから閉じても、どちらでも構いません。 +::: + +::: tip +拡張機能が表示されない・インストールできない場合は、ウィンドウの左下や上部などに「制限モード」と表示されていないか確認してみてください。 + +表示されている場合にはそこをクリックして、その先の画面で「信頼する」をクリックしてください。 +(画像の赤枠部分) + +![](https://md.trap.jp/uploads/upload_90b63cfdbe22831b9c2f838152fab403.png) +::: + +1. `Ctrl`+`,`を押して、出てきた画面に「Auto Save」と入力する。 +2. 「Files: Auto Save」の項目を探して、「afterDelay」に変更する。 ![](https://md.trap.jp/uploads/upload_8a51ad57ec7b6d396cb610c9bbb17040.png) 6. `Ctrl`+`Shift`+`X`を押して、出てきた画面に`Japanese`と入力する。 + +::: tip +`Ctrl`+`Shift`+`X`が反応しない場合は、左側のメニューから「拡張機能」(正方形が4つあるアイコン)を探して開いてください。 +::: + 7. `Japanese Language Pack for Visual Studio Code` をインストールする。 8. インストールが終わったら、右下の`Change Language and Restart`を押してVSCodeを再起動する。 @@ -86,22 +144,39 @@ WSLインストールトラブルシューティング ![](https://md.trap.jp/uploads/upload_b00fe65803252e719a394f50527731d9.png) ::: tip -VSCodeが起動しない場合は、一度ターミナルを閉じて開きなおしてからコマンドを再度実行してみてください。 +`code: command not found`と表示される場合やVSCodeが起動しない場合は、一度ターミナルを閉じて開きなおしてから再度実行してみてください。 ::: -12. [traQのtasksチャンネル](https://q.trap.jp/channels/event/workshop/pg-basic/tasks)でスタンプをつける。 +::: tip +VSCodeが起動した際、ウィンドウの左下や上部などに「制限モード」と表示される場合があります。 + +表示されている場合にはそこをクリックして、その先の画面で「信頼する」をクリックしてください。 +(画像の赤枠部分) + +![](https://md.trap.jp/uploads/upload_90b63cfdbe22831b9c2f838152fab403.png) +::: + +12. [traQのtasksチャンネル](https://q.trap.jp/channels/event/workshop/pg-basic/tasks)でスタンプをつける。 ## Step 4: 拡張機能の設定 +:::warning TA向け +拡張機能が正常に動作しない場合、WSLではなくWindows側のVSCodeに拡張機能がインストールされている可能性があります。WSLのターミナルで`code`コマンドを使ってVSCodeを開いてからインストールするよう案内してください(Windows上で直接VSCodeを起動すると発生しやすいです)。 +::: + 1. VSCodeの画面で`Ctrl`+`Shift`+`X`を押す。 2. `C++`と入力し、「C/C++ Extension Pack」の拡張機能を追加する。 3. `Code Runner`と入力して、「Code Runner」の拡張機能を追加する。 -4. `⌘`+`,`で設定を開く。下記画像の赤丸で囲んだ部分を押して`settings.json`を開く。 +4. `Ctrl`+`,`で設定を開く。下記画像の赤丸で囲んだ部分を押して`settings.json`を開く。 ![](https://md.trap.jp/uploads/upload_bbdd65cb92c5c57bb38f797676aaea8f.png) +:::warning TA向け +`settings.json` の中身がほぼ空(`{}`のみ)でも問題ありません。そのまま5〜6の内容を追加すれば動作します。 +::: + 5. もし`"cpp": `で始まる行がなければ、一番最後の行の1つ前の行(`}`の前!)に次のコードを追加する。その前の行に`,`がなかったら追加する。 -``` +```json "code-runner.executorMap": { "cpp": "cd $dir && clang++ -std=c++2b $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt", }, @@ -147,7 +222,7 @@ int main() { ::: ::: tip -三角のボタンが表示されない場合、ウィンドウの左下に「制限モード」と表示されていないか確認してみてください。 +三角のボタンが表示されない場合、ウィンドウの左下や上部などに「制限モード」と表示されていないか確認してみてください。 表示されている場合にはそこをクリックして、その先の画面で「信頼する」をクリックしてください。 (画像の赤枠部分) diff --git a/docs/cpp/chapter-1/windows_terminal_01.png b/docs/cpp/chapter-1/windows_terminal_01.png new file mode 100644 index 00000000..daa7cd09 Binary files /dev/null and b/docs/cpp/chapter-1/windows_terminal_01.png differ diff --git a/docs/cpp/chapter-1/windows_terminal_02.png b/docs/cpp/chapter-1/windows_terminal_02.png new file mode 100644 index 00000000..a6fb70dd Binary files /dev/null and b/docs/cpp/chapter-1/windows_terminal_02.png differ diff --git a/docs/cpp/chapter-2/2.md b/docs/cpp/chapter-2/2.md index f40bfb99..72847dd9 100644 --- a/docs/cpp/chapter-2/2.md +++ b/docs/cpp/chapter-2/2.md @@ -22,6 +22,10 @@ Windowsの環境構築で少し出てきた「PowerShell」はWindowsを操作 自分の画面とはおそらく違うだろうが、概ねこのような風に`Hello`が表示されれば問題ない。 +::: info +行の冒頭にユーザー名や端末名などが表示されますが、問題ありません。そのままコマンドを入力してください。 +::: + ## 2.2.2 ディレクトリとは ディレクトリは、エクスプローラー(Windows)/Finder(Mac)で「フォルダ」に相当するものである。ターミナルは**常にどこかのディレクトリ上に居るものとして振る舞う。** diff --git a/docs/cpp/chapter-2/3.md b/docs/cpp/chapter-2/3.md index f959ca9b..60ef9899 100644 --- a/docs/cpp/chapter-2/3.md +++ b/docs/cpp/chapter-2/3.md @@ -66,7 +66,7 @@ int main() { 7. `ls`コマンドで`nano-test.cpp`があることを確認する。 8. ターミナル上で、`clang++ nano-test.cpp`と入力すると、プログラムが**コンパイル**される。 9. エラーが出なかったら、`./a.out`と入力し、コンパイルしたプログラムを**実行**できる。 -10. `Hello, traP!`と出力された! +10. `Hello, nano!`と出力された! ::: tip わからなかったり、詰まったりしたらすぐにTAを呼びましょう!