Installing the C* Toolchain
EN | 中文
C* currently supports the platforms darwin-x64darwin-x64, darwin-aarch64darwin-aarch64, and linux-x64linux-x64. There is no native Windows support yet; Windows users can use the C* toolchain through WSL or Docker.
- In VSCode, search for and install the CStar Language extension (pre-release).
- Open the command palette with
ctrl+shift+pctrl+shift+p(orshift+cmd+pshift+cmd+pon macOS), then type and selectCStar IDE: Download CStar ToolchainCStar IDE: Download CStar Toolchain. - Confirm in the dialog that the install script will be fetched from
https://cstarlang.orghttps://cstarlang.org, and click “Yes” to start the download. - Once the download finishes, VSCode will prompt you to restart and enable the extension; if no prompt appears, restart VSCode manually.
- Create a new folder (e.g.
hellohello), initialize a C* project inside it (e.g.cd hello ; cstarc initcd hello ; cstarc init), and open it in VSCode. -
Point
clangdclangdat the C*-modified build (cst_clangdcst_clangd) for a better editing experience.- Option 1: set the workspace
clangd.pathclangd.pathtocst_clangdcst_clangdvia the VSCode settings UI. - Option 2: add
{ "clangd.path": "cst_clangd" }{ "clangd.path": "cst_clangd" }to.vscode/settings.json.vscode/settings.json. - If C* files are still reported as having unrecognized C* syntax while editing, restart VSCode again.
- Option 1: set the workspace
- On Linux or macOS, run
curl -fsSL https://cstarlang.org/install/unix.sh | bashcurl -fsSL https://cstarlang.org/install/unix.sh | bash. - Run
cstarc --helpcstarc --helpfor usage of the command-line tool.
We provide a prebuilt Docker image with the C* toolchain built in. It can be used as a VSCode dev container, with no need to install the toolchain locally.
- Pull the prebuilt image:
docker pull stonebuddha/cstar:latestdocker pull stonebuddha/cstar:latest. - Create
.devcontainer/devcontainer.json.devcontainer/devcontainer.jsonin your project root with the contents below. - Install the Dev Containers extension in VSCode, then run the command
Dev Containers: Reopen in ContainerDev Containers: Reopen in Container.
{ "name": "C* (CStar)", "image": "stonebuddha/cstar:latest", "customizations": { "vscode": { "extensions": [ "cstar-team.cstarlang@prerelease", "llvm-vs-code-extensions.vscode-clangd" ], "settings": { "clangd.path": "cst_clangd", "clangd.checkUpdates": false } } }}
{ "name": "C* (CStar)", "image": "stonebuddha/cstar:latest", "customizations": { "vscode": { "extensions": [ "cstar-team.cstarlang@prerelease", "llvm-vs-code-extensions.vscode-clangd" ], "settings": { "clangd.path": "cst_clangd", "clangd.checkUpdates": false } } }}