C+
Introduction · v0.0.13

Getting started

C+ has two modes: single-file, where one file compiles on its own with built-in helpers, and project, where a Cplus.toml manifest pulls in imports. Pick one mode per program.

Install

On macOS (Apple Silicon), install with Homebrew:

brew install netdur/cplus/cplus
cpc --version

This installs prebuilt cpc, cpc-lsp, and cpc-bindgen with no Rust toolchain and no compile step; update later with brew upgrade cplus. The one external requirement is a C toolchain (clang), used to assemble and link the native binary. On macOS it comes from the Xcode Command Line Tools:

xcode-select --install

Linux and Windows packages are on the way. The front-end commands (cpc check, cpc fmt, cpc lsp, cpc query) need no external tools at all.

Single-file mode

The smallest complete program:

fn main() -> i32 {
    println("hello, world");
    return 0;
}

Build and run it:

cpc hello.cplus -o hello
./hello

In single-file mode println is a built-in intrinsic, so there is no import. It accepts an i32 or a str.

Project mode

A project is a directory with a manifest, a src/, and its dependencies:

hello/
├── Cplus.toml
├── vendor/stdlib   (the standard library)
└── src/main.cplus

Cplus.toml:

[package]
name    = "hello"
version = "0.0.1"
edition = "2026"

[[bin]]
name = "hello"
path = "src/main.cplus"

[dependencies]
stdlib = "*"

src/main.cplus:

import "stdlib/io" as io;

fn main() -> i32 {
    io::println("hello from a project");
    return 0;
}

Build and run:

cpc build
./target/debug/hello

Do not mix the two modes. In a project, use io::println from the standard library, not the intrinsic println.

Next

Continue with Ownership, the part of C+ that differs most from C.