> For the complete documentation index, see [llms.txt](https://mwx.twelite.info/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mwx.twelite.info/v0.1.7/install_n_build/building-act/build-vscode.md).

# VS Codeでのビルド

{% hint style="danger" %}
ビルドには TWELITE STAGE を推奨します。

MWSDK2020\_12 以降、VS Code でのビルド定義については保守更新しません。
{% endhint %}

VS Code では、Act\_samplesディレクトリ直下にあるワークスペースファイルを開くか、Act\_samples以下のアクトディレクトリを開きます。

{% hint style="warning" %}
以下の例では英語インタフェースの画面例で、ワークスペースを開いています。
{% endhint %}

ワークスペースを開き `[Terminal>Run Task...]` を選択します。

![ビルドタスクの一覧表示](/files/-LvnbnyWLoG4kiJv3eba)

ビルドするTWELITE無線モジュールの種別(BLUE/RED)とアクト名を選択します。以下の例ではBuild for TWELITE BLUE PingPong (TWELITE BLUE用/PingPongアクト) を選択しています。選択後すぐにビルドが始まります。

![ビルドタスクの選択](/files/-LvncUdWIAhXZSqLQEqU)

ビルド中の経過は画面下部の TERMINAL 部分に出力されます。

![ビルド経過](/files/-LwLL5jKS3QDHPFtNvq4)

{% hint style="success" %}
正しくビルドできた場合、上記画面例の反転表示部のように .elf ファイルが生成されるメッセージがサイズ情報(`text data bss dec hex filename`と記載がある部分)とともに出力されます。

またBINファイル（上記では `PingPong_BLUE_???.bin`）ファイルがbuildディレクトリ下に出来上がっているはずです。確認してみてください。
{% endhint %}

{% hint style="info" %}
ビルド定義には Windows10 のファイルシステムに適合しないディレクトリ名 (例：`/c/User/...`)を変換する(例：`C:/User/...`) 定義を追加しています。

変換は完全ではありませんが、コンパイルメッセージからエラーが発生しているファイル名と行番号を抽出できます。

`.vscode/tasks.json` 中の実行コマンドは `sh -c "make ... | sed -E -e s#..."` のようにコマンド呼び出しすることで、出力メッセージ中のドライブ名相当部の文字列を書き換えています。

```
...
"windows": {
    "command": "sh",
    "args": [
        "-c", "make TWELITE=BLUE 2>&1 | sed -E -e s#\\(/mnt\\)?/\\([a-zA-Z]\\)/#\\\\\\2:/#g"
    ],
```

{% endhint %}

{% hint style="warning" %}
ビルドがうまくいかない場合は、まず**エラーメッセージを確認**して下さい。**errorという文字列が含まれる行**中のメッセージから、エラー原因が容易に特定できる場合も少なくありません。

念のため、クリーン(`objs_???` ディレクトリにある中間ファイルの削除)を行い、ビルドを再実行してみてください。（他の環境でビルドした中間ファイルが残っていると`make clean`を含めすべての操作が失敗します)
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://mwx.twelite.info/v0.1.7/install_n_build/building-act/build-vscode.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
